qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH 09/15] eepro100: convert to new pci interface
Date: Wed, 10 Feb 2010 12:48:13 +0200	[thread overview]
Message-ID: <20100210104813.GA16789@redhat.com> (raw)
In-Reply-To: <m3d40dz7zi.fsf@blackfin.pond.sub.org>

On Wed, Feb 10, 2010 at 11:43:29AM +0100, Markus Armbruster wrote:
> "Michael S. Tsirkin" <mst@redhat.com> writes:
> 
> > On Wed, Feb 10, 2010 at 07:32:10AM +0100, Stefan Weil wrote:
> >> See my inline comments.
> >> 
> >> 
> >> Anthony Liguori schrieb:
> [...]
> >> > -static void pci_map(PCIDevice * pci_dev, int region_num,
> >> > -                    pcibus_t addr, pcibus_t size, int type)
> >> > +static void pci_io_write(PCIDevice *dev, pcibus_t addr, int size,
> >> > +                         uint32_t value)
> >> >  {
> >> > -    EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev);
> >> > -
> >> > -    TRACE(OTHER, logout("region %d, addr=0x%08"FMT_PCIBUS", "
> >> > -          "size=0x%08"FMT_PCIBUS", type=%d\n",
> >> > -          region_num, addr, size, type));
> >> > +    EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, dev);
> >> >   
> >> 
> >> Please don't change the name of the PCIDevice pointer argument
> >> from pci_dev to dev.
> >> 
> >> This dev, dev in DO_UPCAST is ugly and misleading.
> >
> > It's a matter of taste: I actually think it's pretty: I never remember
> > which argument of DO_UPCAST is which, and if both are dev it doesn't
> > matter.
> 
> I also have trouble remembering how to use DO_UPCAST(), but playing
> games with identifiers is a poor fix for that.  I find the use of the
> same name "dev" for two different things in the same expression rather
> confusing.  Could we improve DO_UPCAST() instead?
> 
> For what it's worth, I have no trouble with container_of().  DO_UPCAST()
> takes the same arguments in a different order, which I find irritating.
> 
> [...]

IMO it would be ideal to remove offset assumptions where possible
and then we can use container_of.

-- 
MST

  reply	other threads:[~2010-02-10 10:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09 22:01 [Qemu-devel] [PATCH 0/15][RFC] New PCI interfaces Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 01/15] pci: add new bus functions Anthony Liguori
2010-02-10  8:09   ` Isaku Yamahata
2010-02-10  8:57   ` [Qemu-devel] " Michael S. Tsirkin
2010-02-09 22:01 ` [Qemu-devel] [PATCH 02/15] rtl8139: convert to new PCI interfaces Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 03/15] lsi53c895a: convert to new pci interfaces Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 04/15] e1000: convert to new pci interface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 05/15] wdt_i6300esb: fix io type leakage Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 06/15] wdt_i6300esb: convert to new pci inteface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 07/15] ac97: convert to new PCI API Anthony Liguori
2010-02-09 22:45   ` malc
2010-02-09 22:52     ` Anthony Liguori
2010-02-09 23:06       ` malc
2010-02-09 23:10         ` Anthony Liguori
2010-02-09 23:36           ` malc
2010-02-09 23:52             ` Anthony Liguori
2010-02-10  0:24               ` malc
2010-02-11 14:20                 ` Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 08/15] es1370: convert to new pci interface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 09/15] eepro100: " Anthony Liguori
2010-02-10  6:32   ` Stefan Weil
2010-02-10  9:49     ` [Qemu-devel] " Michael S. Tsirkin
2010-02-10 10:43       ` Markus Armbruster
2010-02-10 10:48         ` Michael S. Tsirkin [this message]
2010-02-10 14:13     ` [Qemu-devel] " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 10/15] virtio-pci: " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 11/15] pci: add pci_register_msix_region Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 12/15] ne2000: convert to new pci interface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 13/15] pcnet: " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 14/15] usb-uhci: " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 15/15] pci: byte swap as PCI interface layer Anthony Liguori
2010-02-10  9:31 ` [Qemu-devel] Re: [PATCH 0/15][RFC] New PCI interfaces Michael S. Tsirkin
2010-02-10 18:34 ` [Qemu-devel] " Blue Swirl
2010-02-10 19:29   ` Anthony Liguori
2010-02-10 20:41     ` Richard Henderson
2010-02-10 21:13       ` Anthony Liguori
2010-02-12 17:40         ` Blue Swirl
2010-03-01  2:51     ` Paul Brook

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=20100210104813.GA16789@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.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).