* of_match[] warnings
@ 2020-09-30 22:37 Bjorn Helgaas
2020-10-01 12:48 ` Rob Herring
0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2020-09-30 22:37 UTC (permalink / raw)
To: Pratyush Anand, Thomas Petazzoni
Cc: Lorenzo Pieralisi, Rob Herring, linux-pci
These warnings are sort of annoying. I guess most of the other
drivers avoid this by depending on OF as well as COMPILE_TEST.
$ grep -E "CONFIG_(OF|PCIE_(SPEAR13XX|ARMADA_8K))" .config
CONFIG_PCIE_SPEAR13XX=y
CONFIG_PCIE_ARMADA_8K=y
# CONFIG_OF is not set
$ make W=1 drivers/pci/
...
CC drivers/pci/controller/dwc/pcie-spear13xx.o
drivers/pci/controller/dwc/pcie-spear13xx.c:270:34: warning: ‘spear13xx_pcie_of_match’ defined but not used [-Wunused-const-variable=]
270 | static const struct of_device_id spear13xx_pcie_of_match[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~
...
CC drivers/pci/controller/dwc/pcie-armada8k.o
drivers/pci/controller/dwc/pcie-armada8k.c:344:34: warning: ‘armada8k_pcie_of_match’ defined but not used [-Wunused-const-variable=]
344 | static const struct of_device_id armada8k_pcie_of_match[] = {
| ^~~~~~~~~~~~~~~~~~~~~~
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: of_match[] warnings 2020-09-30 22:37 of_match[] warnings Bjorn Helgaas @ 2020-10-01 12:48 ` Rob Herring 2020-10-01 15:53 ` Bjorn Helgaas 0 siblings, 1 reply; 5+ messages in thread From: Rob Herring @ 2020-10-01 12:48 UTC (permalink / raw) To: Bjorn Helgaas; +Cc: Pratyush Anand, Thomas Petazzoni, Lorenzo Pieralisi, PCI On Wed, Sep 30, 2020 at 5:37 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > > These warnings are sort of annoying. I guess most of the other > drivers avoid this by depending on OF as well as COMPILE_TEST. Using the of_match_ptr() macro should prevent this. > $ grep -E "CONFIG_(OF|PCIE_(SPEAR13XX|ARMADA_8K))" .config > CONFIG_PCIE_SPEAR13XX=y > CONFIG_PCIE_ARMADA_8K=y > # CONFIG_OF is not set > > $ make W=1 drivers/pci/ > ... > CC drivers/pci/controller/dwc/pcie-spear13xx.o > drivers/pci/controller/dwc/pcie-spear13xx.c:270:34: warning: ‘spear13xx_pcie_of_match’ defined but not used [-Wunused-const-variable=] > 270 | static const struct of_device_id spear13xx_pcie_of_match[] = { > | ^~~~~~~~~~~~~~~~~~~~~~~ > ... > CC drivers/pci/controller/dwc/pcie-armada8k.o > drivers/pci/controller/dwc/pcie-armada8k.c:344:34: warning: ‘armada8k_pcie_of_match’ defined but not used [-Wunused-const-variable=] > 344 | static const struct of_device_id armada8k_pcie_of_match[] = { > | ^~~~~~~~~~~~~~~~~~~~~~ > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: of_match[] warnings 2020-10-01 12:48 ` Rob Herring @ 2020-10-01 15:53 ` Bjorn Helgaas 2020-10-01 16:43 ` Rob Herring 0 siblings, 1 reply; 5+ messages in thread From: Bjorn Helgaas @ 2020-10-01 15:53 UTC (permalink / raw) To: Rob Herring; +Cc: Pratyush Anand, Thomas Petazzoni, Lorenzo Pieralisi, PCI On Thu, Oct 01, 2020 at 07:48:23AM -0500, Rob Herring wrote: > On Wed, Sep 30, 2020 at 5:37 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > > > > These warnings are sort of annoying. I guess most of the other > > drivers avoid this by depending on OF as well as COMPILE_TEST. > > Using the of_match_ptr() macro should prevent this. Both drivers *do* use of_match_ptr(), but the of_device_id table is unused when of_match_ptr() throws away the pointer. I guess we could add __maybe_unused to squelch the warning. Ugly, but I do think COMPILE_TEST has some value. > > $ grep -E "CONFIG_(OF|PCIE_(SPEAR13XX|ARMADA_8K))" .config > > CONFIG_PCIE_SPEAR13XX=y > > CONFIG_PCIE_ARMADA_8K=y > > # CONFIG_OF is not set > > > > $ make W=1 drivers/pci/ > > ... > > CC drivers/pci/controller/dwc/pcie-spear13xx.o > > drivers/pci/controller/dwc/pcie-spear13xx.c:270:34: warning: ‘spear13xx_pcie_of_match’ defined but not used [-Wunused-const-variable=] > > 270 | static const struct of_device_id spear13xx_pcie_of_match[] = { > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > ... > > CC drivers/pci/controller/dwc/pcie-armada8k.o > > drivers/pci/controller/dwc/pcie-armada8k.c:344:34: warning: ‘armada8k_pcie_of_match’ defined but not used [-Wunused-const-variable=] > > 344 | static const struct of_device_id armada8k_pcie_of_match[] = { > > | ^~~~~~~~~~~~~~~~~~~~~~ > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: of_match[] warnings 2020-10-01 15:53 ` Bjorn Helgaas @ 2020-10-01 16:43 ` Rob Herring 2020-10-01 16:50 ` Bjorn Helgaas 0 siblings, 1 reply; 5+ messages in thread From: Rob Herring @ 2020-10-01 16:43 UTC (permalink / raw) To: Bjorn Helgaas; +Cc: Pratyush Anand, Thomas Petazzoni, Lorenzo Pieralisi, PCI On Thu, Oct 1, 2020 at 10:53 AM Bjorn Helgaas <helgaas@kernel.org> wrote: > > On Thu, Oct 01, 2020 at 07:48:23AM -0500, Rob Herring wrote: > > On Wed, Sep 30, 2020 at 5:37 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > > > > > > These warnings are sort of annoying. I guess most of the other > > > drivers avoid this by depending on OF as well as COMPILE_TEST. > > > > Using the of_match_ptr() macro should prevent this. > > Both drivers *do* use of_match_ptr(), but the of_device_id table is > unused when of_match_ptr() throws away the pointer. Oh right, it's actually we don't want to use of_match_ptr() in this case. > I guess we could add __maybe_unused to squelch the warning. Ugly, but > I do think COMPILE_TEST has some value. We do that or an ifdef for drivers that actually work for !OF. We also have lot's of 'depends on OF' as proposed too, but that's not really my preference given we have empty functions for most everything. Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: of_match[] warnings 2020-10-01 16:43 ` Rob Herring @ 2020-10-01 16:50 ` Bjorn Helgaas 0 siblings, 0 replies; 5+ messages in thread From: Bjorn Helgaas @ 2020-10-01 16:50 UTC (permalink / raw) To: Rob Herring; +Cc: Pratyush Anand, Thomas Petazzoni, Lorenzo Pieralisi, PCI On Thu, Oct 01, 2020 at 11:43:12AM -0500, Rob Herring wrote: > On Thu, Oct 1, 2020 at 10:53 AM Bjorn Helgaas <helgaas@kernel.org> wrote: > > > > On Thu, Oct 01, 2020 at 07:48:23AM -0500, Rob Herring wrote: > > > On Wed, Sep 30, 2020 at 5:37 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > > > > > > > > These warnings are sort of annoying. I guess most of the other > > > > drivers avoid this by depending on OF as well as COMPILE_TEST. > > > > > > Using the of_match_ptr() macro should prevent this. > > > > Both drivers *do* use of_match_ptr(), but the of_device_id table is > > unused when of_match_ptr() throws away the pointer. > > Oh right, it's actually we don't want to use of_match_ptr() in this case. > > > I guess we could add __maybe_unused to squelch the warning. Ugly, but > > I do think COMPILE_TEST has some value. > > We do that or an ifdef for drivers that actually work for !OF. > > We also have lot's of 'depends on OF' as proposed too, but that's not > really my preference given we have empty functions for most > everything. So just removing of_match_ptr() as below? That seems way nicer than any of the #ifdef, __maybe_unused, or "depends on OF" options. diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c index 62846562da0b..b2ef8ffde79e 100644 --- a/drivers/pci/controller/dwc/pcie-spear13xx.c +++ b/drivers/pci/controller/dwc/pcie-spear13xx.c @@ -303,7 +303,7 @@ static struct platform_driver spear13xx_pcie_driver = { .probe = spear13xx_pcie_probe, .driver = { .name = "spear-pcie", - .of_match_table = of_match_ptr(spear13xx_pcie_of_match), + .of_match_table = spear13xx_pcie_of_match, .suppress_bind_attrs = true, }, }; ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-01 16:50 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-09-30 22:37 of_match[] warnings Bjorn Helgaas 2020-10-01 12:48 ` Rob Herring 2020-10-01 15:53 ` Bjorn Helgaas 2020-10-01 16:43 ` Rob Herring 2020-10-01 16:50 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox