lkml.org 
[lkml]   [2019]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH V5 4/6] mdev: introduce virtio device and its device ops
From
Date
On 10/29/2019 6:42 PM, Jason Wang wrote:
> On 2019/10/29 下午3:42, Zhu Lingshan wrote:
>>> +    void (*set_status)(struct mdev_device *mdev, u8 status);
>> Hi Jason
>>
>> Is it possible to make set_status() return an u8 or bool, because this
>> may fail in real hardware. Without a returned code, I am not sure
>> whether it is a good idea to set the status | NEED_RESET when fail.
>>
>> Thanks,
>> BR
>> Zhu Lingshan
>
> Hi:
>
>
> It's possible but I'm not sure whether any user will care about it. E.g
> see virtio_add_status():
>
> void virtio_add_status(struct virtio_device *dev, unsigned int status)
> {
>     might_sleep();
>     dev->config->set_status(dev, dev->config->get_status(dev) | status);
> }
> EXPORT_SYMBOL_GPL(virtio_add_status);
>
> And I believe how it work should be:
>
> virtio_add_status(xyz);
>
> status = virtio_get_status();
>
> if (!(status & xyz))
>
>     error;
>
> Thanks
>
Thanks Jason, then I believe upper layer can handle this well.
>

\
 
 \ /
  Last update: 2019-10-30 08:36    [W:0.040 / U:1.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site