Thread (6 messages) 6 messages, 4 authors, 2014-04-25

Re: [PATCH] pci: Use designated initialization in PCI_VDEVICE

From: Sergei Shtylyov <hidden>
Date: 2014-03-31 22:08:06
Also in: linux-pci

Hello.

On 04/01/2014 01:58 AM, Jeff Kirsher wrote:
From: Mark Rustad <redacted>
By using designated initialization in PCI_VDEVICE, like other
similar macros, many "missing initializer" warnings that appear
when compiling with W=2 can be silenced.
Signed-off-by: Mark Rustad <redacted>
Tested-by: Phil Schmitt <redacted>
Tested-by: Aaron Brown <redacted>
Tested-by: Kavindya Deegala <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
  include/linux/pci.h | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
quoted hunk ↗ jump to hunk
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fb57c89..49455f9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
[...]
quoted hunk ↗ jump to hunk
@@ -689,9 +689,9 @@ struct pci_driver {
   * 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, 0, 0
    Initializing the fields to 0 is pointless, as 0 is what should be put into 
them anyway by the compiler. Also, it doesn't look right when you mix 
designated and anonymous initializers.

WBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help