All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] davinci_emac: always build in CONFIG_OF code
@ 2019-03-07  9:31 Arnd Bergmann
  2019-03-07 15:16 ` Nathan Chancellor
  2019-03-07 17:29 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-03-07  9:31 UTC (permalink / raw)
  To: David S. Miller
  Cc: Nick Desaulniers, Arnd Bergmann, Grygorii Strashko,
	Bartosz Golaszewski, linux-omap, netdev, linux-kernel

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/ti/davinci_emac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 840820402cd0..57450b174fc4 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -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,
-- 
2.20.0


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

* Re: [PATCH] davinci_emac: always build in CONFIG_OF code
  2019-03-07  9:31 [PATCH] davinci_emac: always build in CONFIG_OF code Arnd Bergmann
@ 2019-03-07 15:16 ` Nathan Chancellor
  2019-03-07 17:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2019-03-07 15:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David S. Miller, Nick Desaulniers, Grygorii Strashko,
	Bartosz Golaszewski, linux-omap, netdev, linux-kernel

On Thu, Mar 07, 2019 at 10:31:20AM +0100, Arnd Bergmann wrote:
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  drivers/net/ethernet/ti/davinci_emac.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
> index 840820402cd0..57450b174fc4 100644
> --- a/drivers/net/ethernet/ti/davinci_emac.c
> +++ b/drivers/net/ethernet/ti/davinci_emac.c
> @@ -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,
> -- 
> 2.20.0
> 

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

* Re: [PATCH] davinci_emac: always build in CONFIG_OF code
  2019-03-07  9:31 [PATCH] davinci_emac: always build in CONFIG_OF code Arnd Bergmann
  2019-03-07 15:16 ` Nathan Chancellor
@ 2019-03-07 17:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-07 17:29 UTC (permalink / raw)
  To: arnd
  Cc: ndesaulniers, grygorii.strashko, bgolaszewski, linux-omap,
	netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Thu,  7 Mar 2019 10:31:20 +0100

> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.

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

end of thread, other threads:[~2019-03-07 17:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07  9:31 [PATCH] davinci_emac: always build in CONFIG_OF code Arnd Bergmann
2019-03-07 15:16 ` Nathan Chancellor
2019-03-07 17:29 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.