Re: [PATCH 2/3] virtio: use dev_to_virtio wrapper in virtio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 05, 2012 at 03:03:28PM +0800, Wanlong Gao wrote:
> Use dev_to_virtio wrapper in virtio to make code clearly.
> 
> Signed-off-by: Wanlong Gao <gaowanlong@xxxxxxxxxxxxxx>
> ---
> diff --git a/include/linux/virtio.h b/include/linux/virtio.h
> index 25fa1a6..30fc3c9 100644
> --- a/include/linux/virtio.h
> +++ b/include/linux/virtio.h
> @@ -79,7 +79,7 @@ struct virtio_device {
>  	void *priv;
>  };
>  
> -#define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev)
> +#define dev_to_virtio(_dev) container_of(_dev, struct virtio_device, dev)
>  int register_virtio_device(struct virtio_device *dev);
>  void unregister_virtio_device(struct virtio_device *dev);


More importantly this would fix dev_to_virtio since ATM

dev_to_virtio(_d) resolves to
 container_of(_d, struct virtio_device, _d)

which is not what was intended.

However, I think this shows that using a macro here
is a mistake. Could you code this up with a static inline
function instead please?

>  
> -- 
> 1.8.0
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux