diff mbox series

PCI: Drop of_match_ptr() to avoid unused variables

Message ID 20220706195838.217054-1-helgaas@kernel.org (mailing list archive)
State New, archived
Headers show
Series PCI: Drop of_match_ptr() to avoid unused variables | expand

Commit Message

Bjorn Helgaas July 6, 2022, 7:58 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

We have stubs for most OF interfaces even when CONFIG_OF is not set, so we
allow building of most controller drivers in that case for compile testing.

When CONFIG_OF is not set, "of_match_ptr(<match_table>)" compiles to NULL,
which leaves <match_table> unused, resulting in errors like this:

  $ make W=1
  drivers/pci/controller/pci-xgene.c:636:34: error: ‘xgene_pcie_match_table’ defined but not used [-Werror=unused-const-variable=]

Drop of_match_ptr() to avoid the unused variable warning.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/controller/dwc/pci-keystone.c   | 2 +-
 drivers/pci/controller/dwc/pcie-armada8k.c  | 2 +-
 drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +-
 drivers/pci/controller/pci-xgene.c          | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Comments

Bjorn Helgaas July 11, 2022, 10:32 p.m. UTC | #1
On Wed, Jul 06, 2022 at 02:58:38PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> We have stubs for most OF interfaces even when CONFIG_OF is not set, so we
> allow building of most controller drivers in that case for compile testing.
> 
> When CONFIG_OF is not set, "of_match_ptr(<match_table>)" compiles to NULL,
> which leaves <match_table> unused, resulting in errors like this:
> 
>   $ make W=1
>   drivers/pci/controller/pci-xgene.c:636:34: error: ‘xgene_pcie_match_table’ defined but not used [-Werror=unused-const-variable=]
> 
> Drop of_match_ptr() to avoid the unused variable warning.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

I applied this on pci/misc for v5.20.  Holler if you object :)

> ---
>  drivers/pci/controller/dwc/pci-keystone.c   | 2 +-
>  drivers/pci/controller/dwc/pcie-armada8k.c  | 2 +-
>  drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +-
>  drivers/pci/controller/pci-xgene.c          | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
> index d10e5fd0f83c..602909f712b9 100644
> --- a/drivers/pci/controller/dwc/pci-keystone.c
> +++ b/drivers/pci/controller/dwc/pci-keystone.c
> @@ -1324,7 +1324,7 @@ static struct platform_driver ks_pcie_driver __refdata = {
>  	.remove = __exit_p(ks_pcie_remove),
>  	.driver = {
>  		.name	= "keystone-pcie",
> -		.of_match_table = of_match_ptr(ks_pcie_of_match),
> +		.of_match_table = ks_pcie_of_match,
>  	},
>  };
>  builtin_platform_driver(ks_pcie_driver);
> diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c
> index 4e2552dcf982..8391417fad41 100644
> --- a/drivers/pci/controller/dwc/pcie-armada8k.c
> +++ b/drivers/pci/controller/dwc/pcie-armada8k.c
> @@ -343,7 +343,7 @@ static struct platform_driver armada8k_pcie_driver = {
>  	.probe		= armada8k_pcie_probe,
>  	.driver = {
>  		.name	= "armada8k-pcie",
> -		.of_match_table = of_match_ptr(armada8k_pcie_of_match),
> +		.of_match_table = armada8k_pcie_of_match,
>  		.suppress_bind_attrs = true,
>  	},
>  };
> diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c
> index 1569e82b5568..48af5170a8e7 100644
> --- a/drivers/pci/controller/dwc/pcie-spear13xx.c
> +++ b/drivers/pci/controller/dwc/pcie-spear13xx.c
> @@ -258,7 +258,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,
>  	},
>  };
> diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
> index eb6240958bb0..549d3bd6d1c2 100644
> --- a/drivers/pci/controller/pci-xgene.c
> +++ b/drivers/pci/controller/pci-xgene.c
> @@ -641,7 +641,7 @@ static const struct of_device_id xgene_pcie_match_table[] = {
>  static struct platform_driver xgene_pcie_driver = {
>  	.driver = {
>  		.name = "xgene-pcie",
> -		.of_match_table = of_match_ptr(xgene_pcie_match_table),
> +		.of_match_table = xgene_pcie_match_table,
>  		.suppress_bind_attrs = true,
>  	},
>  	.probe = xgene_pcie_probe,
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index d10e5fd0f83c..602909f712b9 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1324,7 +1324,7 @@  static struct platform_driver ks_pcie_driver __refdata = {
 	.remove = __exit_p(ks_pcie_remove),
 	.driver = {
 		.name	= "keystone-pcie",
-		.of_match_table = of_match_ptr(ks_pcie_of_match),
+		.of_match_table = ks_pcie_of_match,
 	},
 };
 builtin_platform_driver(ks_pcie_driver);
diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c
index 4e2552dcf982..8391417fad41 100644
--- a/drivers/pci/controller/dwc/pcie-armada8k.c
+++ b/drivers/pci/controller/dwc/pcie-armada8k.c
@@ -343,7 +343,7 @@  static struct platform_driver armada8k_pcie_driver = {
 	.probe		= armada8k_pcie_probe,
 	.driver = {
 		.name	= "armada8k-pcie",
-		.of_match_table = of_match_ptr(armada8k_pcie_of_match),
+		.of_match_table = armada8k_pcie_of_match,
 		.suppress_bind_attrs = true,
 	},
 };
diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c
index 1569e82b5568..48af5170a8e7 100644
--- a/drivers/pci/controller/dwc/pcie-spear13xx.c
+++ b/drivers/pci/controller/dwc/pcie-spear13xx.c
@@ -258,7 +258,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,
 	},
 };
diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index eb6240958bb0..549d3bd6d1c2 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -641,7 +641,7 @@  static const struct of_device_id xgene_pcie_match_table[] = {
 static struct platform_driver xgene_pcie_driver = {
 	.driver = {
 		.name = "xgene-pcie",
-		.of_match_table = of_match_ptr(xgene_pcie_match_table),
+		.of_match_table = xgene_pcie_match_table,
 		.suppress_bind_attrs = true,
 	},
 	.probe = xgene_pcie_probe,