All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulrich Eckhardt <doomster@knuut.de>
To: linux-kernel@vger.kernel.org
Subject: [patch] use C99 initialisers for PCI_VDEVICE()
Date: Sun, 15 Apr 2007 12:34:36 +0200	[thread overview]
Message-ID: <200704151234.37463.doomster@knuut.de> (raw)

(Note: CC me please, I'm not subscribed.)

Not much to say about the patch (it's against 2.6.20.6), it just converts a 
macro to generate C99-style initialisers.

--- include/linux/pci.h   (revision 17)
+++ include/linux/pci.h   (working copy)
@@ -407,9 +407,10 @@
  * private data.
  */
 
-#define PCI_VDEVICE(vendor, device)            \
-       PCI_VENDOR_ID_##vendor, (device),       \
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0
+#define PCI_VDEVICE(vend, dev)         \
+       .vendor=PCI_VENDOR_ID_##vend, .device=(dev),    \
+       .subvendor=PCI_ANY_ID, .subdevice=PCI_ANY_ID,   \
+       .class=0, .class_mask=0


However, I still have two issues with this:
1. It explicitly allows in the comments for PCI_VDEVICE to have non-C99 fields 
follow for the driver_data field. IMHO this is wrong per se (just as 
old-style initialisers are), so the comment should perhaps be removed.
2. What happens to fields not initialised with this? I believe that these are 
initialised with zero, just like missing fields in old initialisers are, 
right? In that case, I would remove the initialisers for class and 
class_mask, so that people can at least optionally use them. However, this 
goes hand in hand with issue #1 because it would definitely break code that 
lets old-style initialisers follow.

As far as issue #2 is concerned, I did some checking (grep -r PCI_VDEVICE) and 
the only places where this is at all used is in the ATA code (drivers/ata)! 
Hmmm, no problem, that is grunt work but easily patched, too. If consensus 
exists that the class/class_mask fields should be removed, I hereby volunteer 
to submit a patch for that and the ATA code.

Uli

             reply	other threads:[~2007-04-15 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-15 10:34 Ulrich Eckhardt [this message]
2007-04-15 12:53 ` [patch] use C99 initialisers for PCI_VDEVICE() Jeff Garzik
2007-04-15 13:32   ` Ulrich Eckhardt

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=200704151234.37463.doomster@knuut.de \
    --to=doomster@knuut.de \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.