On Wed, Dec 05, 2012 at 01:16:06PM +0200, Michael S. Tsirkin wrote:
> 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 <gaowanl...@cn.fujitsu.com>
> > ---
> > 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?

And probably move it to virtio.c there seems to be no need
to keep it in virtio.h

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

Reply via email to