From: "Michael S. Tsirkin" <mst@redhat.com>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 2/3] virtio: use dev_to_virtio wrapper in virtio
Date: Wed, 5 Dec 2012 13:17:10 +0200 [thread overview]
Message-ID: <20121205111710.GA10437@redhat.com> (raw)
In-Reply-To: <20121205111606.GB10045@redhat.com>
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 <gaowanlong@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
next prev parent reply other threads:[~2012-12-05 11:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 7:03 [PATCH 1/3] virtio: change to_vp_device to an inlined definition Wanlong Gao
2012-12-05 7:03 ` [PATCH 2/3] virtio: use dev_to_virtio wrapper in virtio Wanlong Gao
2012-12-05 11:16 ` Michael S. Tsirkin
2012-12-05 11:17 ` Michael S. Tsirkin [this message]
2012-12-05 12:59 ` Wanlong Gao
2012-12-05 7:03 ` [PATCH 3/3] virtio: add drv_to_virtio to make code clearly Wanlong Gao
2012-12-05 11:17 ` Michael S. Tsirkin
2012-12-05 11:25 ` [PATCH 1/3] virtio: change to_vp_device to an inlined definition Michael S. Tsirkin
2012-12-05 13:28 ` [PATCH V2 1/2] virtio: use dev_to_virtio wrapper in virtio Wanlong Gao
2012-12-05 13:28 ` [PATCH V2 2/2] virtio: add drv_to_virtio to make code clearly Wanlong Gao
2012-12-05 22:28 ` [PATCH 1/3] virtio: change to_vp_device to an inlined definition Stephen Hemminger
2012-12-05 23:28 ` Rusty Russell
2012-12-05 23:21 ` Rusty Russell
2012-12-06 6:10 ` Wanlong Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121205111710.GA10437@redhat.com \
--to=mst@redhat.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).