From: Bjorn Helgaas <bhelgaas@google.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
Mark Rustad <mark.d.rustad@intel.com>,
linux-pci@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] pci: Use designated initialization in PCI_VDEVICE
Date: Thu, 24 Apr 2014 15:22:46 -0600 [thread overview]
Message-ID: <20140424212246.GG29593@google.com> (raw)
In-Reply-To: <5339E746.4030503@cogentembedded.com>
On Tue, Apr 01, 2014 at 02:08:06AM +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 04/01/2014 01:58 AM, Jeff Kirsher wrote:
>
> >From: Mark Rustad <mark.d.rustad@intel.com>
>
> >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 <mark.d.rustad@intel.com>
> >Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> >Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> >Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
> >Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> >---
> > include/linux/pci.h | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
>
> >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
> [...]
> >@@ -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.
I'm certainly willing to apply this, but I can't reproduce the benefit. I
tried "make W=2 drivers/net/ethernet/intel/e1000e/netdev.o" and didn't see
any change before and after this patch (I'm using Ubuntu gcc 4.6.3 if it
matters).
What am I missing? And do we need the zeroes?
Bjorn
next prev parent reply other threads:[~2014-04-24 21:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 21:58 [PATCH] pci: Use designated initialization in PCI_VDEVICE Jeff Kirsher
2014-03-31 22:08 ` Sergei Shtylyov
2014-04-24 21:22 ` Bjorn Helgaas [this message]
2014-04-24 23:15 ` Rustad, Mark D
2014-04-24 23:43 ` Rustad, Mark D
2014-04-25 0:10 ` Bjorn Helgaas
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=20140424212246.GG29593@google.com \
--to=bhelgaas@google.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=linux-pci@vger.kernel.org \
--cc=mark.d.rustad@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/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).