Skip to contentSkip to conversation

davinci_emac: always build in CONFIG_OF code

PATCH Applied Arnd Bergmann 3 participants 3 messages Mar 7, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 davinci_emac: always build in CONFIG_OF code

clang warns about what seems to be an unintended use of an obscure C language feature where a forward declaration of an array remains usable when the final definition is never seen:

drivers/net/ethernet/ti/davinci_emac.c:1694:34: error: tentative array definition assumed to have one element [-Werror] static const struct of_device_id davinci_emac_of_match[];

There is no harm in always enabling the device tree matching code here, and it makes the code behave in a more conventional way aside from avoiding the warning.

---
 drivers/net/ethernet/ti/davinci_emac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +1 -3
index 840820402cd0..57450b174fc4 100644
@@ -2029,7 +2029,6 @@ static const struct dev_pm_ops davinci_emac_pm_ops = {
 	.resume		= davinci_emac_resume,
 };
 
-#if IS_ENABLED(CONFIG_OF)
 static const struct emac_platform_data am3517_emac_data = {
 	.version		= EMAC_VERSION_2,
 	.hw_ram_addr		= 0x01e20000,
@@ -2046,14 +2045,13 @@ static const struct of_device_id davinci_emac_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, davinci_emac_of_match);
-#endif
 
 /* davinci_emac_driver: EMAC platform driver structure */
 static struct platform_driver davinci_emac_driver = {
 	.driver = {
 		.name	 = "davinci_emac",
 		.pm	 = &davinci_emac_pm_ops,
-		.of_match_table = of_match_ptr(davinci_emac_of_match),
+		.of_match_table = davinci_emac_of_match,
 	},
 	.probe = davinci_emac_probe,
 	.remove = davinci_emac_remove,
Signature · 1 line
2.20.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Arnd Bergmann

clang warns about what seems to be an unintended use of an obscure C language feature where a forward declaration of an array remains usable when the final definition is never seen:

Quoted 8 lines

drivers/net/ethernet/ti/davinci_emac.c:1694:34: error: tentative array definition assumed to have one element [-Werror] static const struct of_device_id davinci_emac_of_match[];

There is no harm in always enabling the device tree matching code here, and it makes the code behave in a more conventional way aside from avoiding the warning.

Quoted 35 lines
---
 drivers/net/ethernet/ti/davinci_emac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +1 -3
index 840820402cd0..57450b174fc4 100644
@@ -2029,7 +2029,6 @@ static const struct dev_pm_ops davinci_emac_pm_ops = {
 	.resume		= davinci_emac_resume,
 };
 
-#if IS_ENABLED(CONFIG_OF)
 static const struct emac_platform_data am3517_emac_data = {
 	.version		= EMAC_VERSION_2,
 	.hw_ram_addr		= 0x01e20000,
@@ -2046,14 +2045,13 @@ static const struct of_device_id davinci_emac_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, davinci_emac_of_match);
-#endif
 
 /* davinci_emac_driver: EMAC platform driver structure */
 static struct platform_driver davinci_emac_driver = {
 	.driver = {
 		.name	 = "davinci_emac",
 		.pm	 = &davinci_emac_pm_ops,
-		.of_match_table = of_match_ptr(davinci_emac_of_match),
+		.of_match_table = davinci_emac_of_match,
 	},
 	.probe = davinci_emac_probe,
 	.remove = davinci_emac_remove,
Signature · 1 line
2.20.0
maintainer Applied
#2 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Thu, 7 Mar 2019 10:31:20 +0100

Quoted 4 lines

clang warns about what seems to be an unintended use of an obscure C language feature where a forward declaration of an array remains usable when the final definition is never seen:

Quoted 8 lines

drivers/net/ethernet/ti/davinci_emac.c:1694:34: error: tentative array definition assumed to have one element [-Werror] static const struct of_device_id davinci_emac_of_match[];

There is no harm in always enabling the device tree matching code here, and it makes the code behave in a more conventional way aside from avoiding the warning.

Applied.