On 1/5/21 10:16 PM, David Marchand wrote:
> On Sun, Dec 20, 2020 at 10:14 PM Maxime Coquelin
> <maxime.coque...@redhat.com> wrote:
>>
>> This patch moves the virtio_hw structure into the virtio_user_dev
>> structure, with the goal of making virtio_hw bus-agnostic.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com>
> 
> Just one comment, the rest lgtm.
> 
> 
>> diff --git a/drivers/net/virtio/virtio_user_ethdev.c 
>> b/drivers/net/virtio/virtio_user_ethdev.c
>> index 516d0ee577..1f1f63a1a5 100644
>> --- a/drivers/net/virtio/virtio_user_ethdev.c
>> +++ b/drivers/net/virtio/virtio_user_ethdev.c
>> @@ -26,13 +26,13 @@
>>  #include "virtio_user/virtio_user_dev.h"
>>  #include "virtio_user/vhost.h"
>>
>> -#define virtio_user_get_dev(hw) \
>> -       ((struct virtio_user_dev *)(hw)->virtio_user_dev)
>> +#define virtio_user_get_dev(hw) container_of(hw, struct virtio_user_dev, hw)
> 
> Since the hw parameter is expanded as both the object and the field
> name too, this macro prevents us from calling anything but
> virtio_user_get_dev(hw).

Indeed!

I propose to change the parameter to hwp (hw pointer).

Thanks,
Maxime


Reply via email to