linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [pci:pci/portdrv 1/1] drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
       [not found] <201902151544.kWECyQ24%fengguang.wu@intel.com>
@ 2019-02-15  8:18 ` Honghui Zhang
  2019-02-15 20:00   ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: Honghui Zhang @ 2019-02-15  8:18 UTC (permalink / raw)
  To: kbuild test robot, Bjorn Helgaas; +Cc: kbuild-all, linux-pci, Bjorn Helgaas

On Fri, 2019-02-15 at 15:34 +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/portdrv
> head:   b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa
> commit: b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa [1/1] PCI/portdrv: Support PCIe services on subtractive decode bridges
> reproduce:
>         # apt-get install sparse
>         git checkout b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa
>         make ARCH=x86_64 allmodconfig
>         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
>    drivers/pci/pcie/portdrv_pci.c:189:9: sparse:   also defined here
> 
> sparse warnings: (new ones prefixed by >>)
> 
>    drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
> >> drivers/pci/pcie/portdrv_pci.c:189:9: sparse:   also defined here
> 
> vim +187 drivers/pci/pcie/portdrv_pci.c
> 
> ^1da177e Linus Torvalds 2005-04-16  181  
> ^1da177e Linus Torvalds 2005-04-16  182  /*
> ^1da177e Linus Torvalds 2005-04-16  183   * LINUX Device Driver Model
> ^1da177e Linus Torvalds 2005-04-16  184   */
> ^1da177e Linus Torvalds 2005-04-16  185  static const struct pci_device_id port_pci_ids[] = { {
> ^1da177e Linus Torvalds 2005-04-16  186  	/* handle any PCI-Express port */
> ^1da177e Linus Torvalds 2005-04-16 @187  	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0),
> b4f663e3 Honghui Zhang  2019-02-14  188  	/* subtractive decode PCI-to-PCI bridge, class type is 060401h */
> b4f663e3 Honghui Zhang  2019-02-14 @189  	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0),
> ^1da177e Linus Torvalds 2005-04-16  190  	}, { /* end: all zeroes */ }
> ^1da177e Linus Torvalds 2005-04-16  191  };
> ^1da177e Linus Torvalds 2005-04-16  192  
> 
Hi, Bjorn,
Do you think drop this one, and I send a new version is a good idea? Or
will you re-consider the first version patch?

Thanks.

> :::::: The code at line 187 was first introduced by commit
> :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
> 
> :::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
> :::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pci:pci/portdrv 1/1] drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
  2019-02-15  8:18 ` [pci:pci/portdrv 1/1] drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice Honghui Zhang
@ 2019-02-15 20:00   ` Bjorn Helgaas
  2019-02-18  0:42     ` Honghui Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2019-02-15 20:00 UTC (permalink / raw)
  To: Honghui Zhang; +Cc: kbuild test robot, kbuild-all, linux-pci

On Fri, Feb 15, 2019 at 04:18:43PM +0800, Honghui Zhang wrote:
> On Fri, 2019-02-15 at 15:34 +0800, kbuild test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/portdrv
> > head:   b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa
> > commit: b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa [1/1] PCI/portdrv: Support PCIe services on subtractive decode bridges
> > reproduce:
> >         # apt-get install sparse
> >         git checkout b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa
> >         make ARCH=x86_64 allmodconfig
> >         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> > 
> > All warnings (new ones prefixed by >>):
> > 
> > >> drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
> >    drivers/pci/pcie/portdrv_pci.c:189:9: sparse:   also defined here
> > 
> > sparse warnings: (new ones prefixed by >>)
> > 
> >    drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
> > >> drivers/pci/pcie/portdrv_pci.c:189:9: sparse:   also defined here
> > 
> > vim +187 drivers/pci/pcie/portdrv_pci.c
> > 
> > ^1da177e Linus Torvalds 2005-04-16  181  
> > ^1da177e Linus Torvalds 2005-04-16  182  /*
> > ^1da177e Linus Torvalds 2005-04-16  183   * LINUX Device Driver Model
> > ^1da177e Linus Torvalds 2005-04-16  184   */
> > ^1da177e Linus Torvalds 2005-04-16  185  static const struct pci_device_id port_pci_ids[] = { {
> > ^1da177e Linus Torvalds 2005-04-16  186  	/* handle any PCI-Express port */
> > ^1da177e Linus Torvalds 2005-04-16 @187  	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0),
> > b4f663e3 Honghui Zhang  2019-02-14  188  	/* subtractive decode PCI-to-PCI bridge, class type is 060401h */
> > b4f663e3 Honghui Zhang  2019-02-14 @189  	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0),
> > ^1da177e Linus Torvalds 2005-04-16  190  	}, { /* end: all zeroes */ }
> > ^1da177e Linus Torvalds 2005-04-16  191  };
> > ^1da177e Linus Torvalds 2005-04-16  192  
> > 
> Hi, Bjorn,
> Do you think drop this one, and I send a new version is a good idea? Or
> will you re-consider the first version patch?

The problem was just missing braces.  I replaced it with the following
patches:

commit c89f7f98c971e0cabc819b6c0fe6bf509287b7e0
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Fri Feb 15 13:49:18 2019 -0600

    PCI/portdrv: Use conventional Device ID table formatting
    
    The pci_device_id table was technically correct, but unusually formatted,
    which made adding entries error-prone.  Change the format so it's obvious
    how to add entries.
    
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 0acca3596807..a289e734b9a4 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -182,10 +182,10 @@ static void pcie_portdrv_err_resume(struct pci_dev *dev)
 /*
  * LINUX Device Driver Model
  */
-static const struct pci_device_id port_pci_ids[] = { {
+static const struct pci_device_id port_pci_ids[] = {
 	/* handle any PCI-Express port */
-	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0),
-	}, { /* end: all zeroes */ }
+	{ PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) },
+	{ },
 };
 
 static const struct pci_error_handlers pcie_portdrv_err_handler = {

commit f0cfecea8d1e8e0cd5d5053f9452b3a450f49eb5
Author: Honghui Zhang <honghui.zhang@mediatek.com>
Date:   Thu Feb 14 13:21:17 2019 +0800

    PCI/portdrv: Support PCIe services on subtractive decode bridges
    
    The Class Code for subtractive decode PCI-to-PCI bridge is 060401h; add an
    entry to make portdrv support this type of bridge.  This allows use of PCIe
    services on subtractive decode ports.
    
    Signed-off-by: Honghui Zhang <honghui.zhang@mediatek.com>
    [bhelgaas: add braces surrounding entry]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index a289e734b9a4..99d2abe88d0b 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -185,6 +185,8 @@ static void pcie_portdrv_err_resume(struct pci_dev *dev)
 static const struct pci_device_id port_pci_ids[] = {
 	/* handle any PCI-Express port */
 	{ PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) },
+	/* subtractive decode PCI-to-PCI bridge, class type is 060401h */
+	{ PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0) },
 	{ },
 };
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [pci:pci/portdrv 1/1] drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
  2019-02-15 20:00   ` Bjorn Helgaas
@ 2019-02-18  0:42     ` Honghui Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Honghui Zhang @ 2019-02-18  0:42 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: kbuild test robot, kbuild-all, linux-pci

On Fri, 2019-02-15 at 14:00 -0600, Bjorn Helgaas wrote:
> On Fri, Feb 15, 2019 at 04:18:43PM +0800, Honghui Zhang wrote:
> > On Fri, 2019-02-15 at 15:34 +0800, kbuild test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/portdrv
> > > head:   b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa
> > > commit: b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa [1/1] PCI/portdrv: Support PCIe services on subtractive decode bridges
> > > reproduce:
> > >         # apt-get install sparse
> > >         git checkout b4f663e35a545fbdc71b3bbf2df88ef9f124a3fa
> > >         make ARCH=x86_64 allmodconfig
> > >         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> > > 
> > > All warnings (new ones prefixed by >>):
> > > 
> > > >> drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
> > >    drivers/pci/pcie/portdrv_pci.c:189:9: sparse:   also defined here
> > > 
> > > sparse warnings: (new ones prefixed by >>)
> > > 
> > >    drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice
> > > >> drivers/pci/pcie/portdrv_pci.c:189:9: sparse:   also defined here
> > > 
> > > vim +187 drivers/pci/pcie/portdrv_pci.c
> > > 
> > > ^1da177e Linus Torvalds 2005-04-16  181  
> > > ^1da177e Linus Torvalds 2005-04-16  182  /*
> > > ^1da177e Linus Torvalds 2005-04-16  183   * LINUX Device Driver Model
> > > ^1da177e Linus Torvalds 2005-04-16  184   */
> > > ^1da177e Linus Torvalds 2005-04-16  185  static const struct pci_device_id port_pci_ids[] = { {
> > > ^1da177e Linus Torvalds 2005-04-16  186  	/* handle any PCI-Express port */
> > > ^1da177e Linus Torvalds 2005-04-16 @187  	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0),
> > > b4f663e3 Honghui Zhang  2019-02-14  188  	/* subtractive decode PCI-to-PCI bridge, class type is 060401h */
> > > b4f663e3 Honghui Zhang  2019-02-14 @189  	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0),
> > > ^1da177e Linus Torvalds 2005-04-16  190  	}, { /* end: all zeroes */ }
> > > ^1da177e Linus Torvalds 2005-04-16  191  };
> > > ^1da177e Linus Torvalds 2005-04-16  192  
> > > 
> > Hi, Bjorn,
> > Do you think drop this one, and I send a new version is a good idea? Or
> > will you re-consider the first version patch?
> 
> The problem was just missing braces.  I replaced it with the following
> patches:

Oh, my mistake, thanks very much for pointing this out and fix it.

Thanks.
> 
> commit c89f7f98c971e0cabc819b6c0fe6bf509287b7e0
> Author: Bjorn Helgaas <bhelgaas@google.com>
> Date:   Fri Feb 15 13:49:18 2019 -0600
> 
>     PCI/portdrv: Use conventional Device ID table formatting
>     
>     The pci_device_id table was technically correct, but unusually formatted,
>     which made adding entries error-prone.  Change the format so it's obvious
>     how to add entries.
>     
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
> index 0acca3596807..a289e734b9a4 100644
> --- a/drivers/pci/pcie/portdrv_pci.c
> +++ b/drivers/pci/pcie/portdrv_pci.c
> @@ -182,10 +182,10 @@ static void pcie_portdrv_err_resume(struct pci_dev *dev)
>  /*
>   * LINUX Device Driver Model
>   */
> -static const struct pci_device_id port_pci_ids[] = { {
> +static const struct pci_device_id port_pci_ids[] = {
>  	/* handle any PCI-Express port */
> -	PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0),
> -	}, { /* end: all zeroes */ }
> +	{ PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) },
> +	{ },
>  };
>  
>  static const struct pci_error_handlers pcie_portdrv_err_handler = {
> 
> commit f0cfecea8d1e8e0cd5d5053f9452b3a450f49eb5
> Author: Honghui Zhang <honghui.zhang@mediatek.com>
> Date:   Thu Feb 14 13:21:17 2019 +0800
> 
>     PCI/portdrv: Support PCIe services on subtractive decode bridges
>     
>     The Class Code for subtractive decode PCI-to-PCI bridge is 060401h; add an
>     entry to make portdrv support this type of bridge.  This allows use of PCIe
>     services on subtractive decode ports.
>     
>     Signed-off-by: Honghui Zhang <honghui.zhang@mediatek.com>
>     [bhelgaas: add braces surrounding entry]
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
> index a289e734b9a4..99d2abe88d0b 100644
> --- a/drivers/pci/pcie/portdrv_pci.c
> +++ b/drivers/pci/pcie/portdrv_pci.c
> @@ -185,6 +185,8 @@ static void pcie_portdrv_err_resume(struct pci_dev *dev)
>  static const struct pci_device_id port_pci_ids[] = {
>  	/* handle any PCI-Express port */
>  	{ PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) },
> +	/* subtractive decode PCI-to-PCI bridge, class type is 060401h */
> +	{ PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0) },
>  	{ },
>  };
>  



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-18  0:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201902151544.kWECyQ24%fengguang.wu@intel.com>
2019-02-15  8:18 ` [pci:pci/portdrv 1/1] drivers/pci/pcie/portdrv_pci.c:187:9: sparse: warning: Initializer entry defined twice Honghui Zhang
2019-02-15 20:00   ` Bjorn Helgaas
2019-02-18  0:42     ` Honghui Zhang

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).