All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id
@ 2021-02-09 21:12 George McCollister
  2021-02-09 21:12 ` [PATCH net-next 2/2] net: dsa: xrs700x: use of_match_ptr() on xrs700x_mdio_dt_ids George McCollister
  2021-02-09 21:27 ` [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id Florian Fainelli
  0 siblings, 2 replies; 4+ messages in thread
From: George McCollister @ 2021-02-09 21:12 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	netdev, George McCollister

Fix unused variable warning that occurs when CONFIG_OF isn't defined by
adding __maybe_unused.

>> drivers/net/dsa/xrs700x/xrs700x_i2c.c:127:34: warning: unused
variable 'xrs700x_i2c_dt_ids' [-Wunused-const-variable]
   static const struct of_device_id xrs700x_i2c_dt_ids[] = {

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: George McCollister <george.mccollister@gmail.com>
---
 drivers/net/dsa/xrs700x/xrs700x_i2c.c  | 2 +-
 drivers/net/dsa/xrs700x/xrs700x_mdio.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/xrs700x/xrs700x_i2c.c b/drivers/net/dsa/xrs700x/xrs700x_i2c.c
index 16a46a78a037..489d9385b4f0 100644
--- a/drivers/net/dsa/xrs700x/xrs700x_i2c.c
+++ b/drivers/net/dsa/xrs700x/xrs700x_i2c.c
@@ -121,7 +121,7 @@ static const struct i2c_device_id xrs700x_i2c_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, xrs700x_i2c_id);
 
-static const struct of_device_id xrs700x_i2c_dt_ids[] = {
+static const struct of_device_id __maybe_unused xrs700x_i2c_dt_ids[] = {
 	{ .compatible = "arrow,xrs7003e", .data = &xrs7003e_info },
 	{ .compatible = "arrow,xrs7003f", .data = &xrs7003f_info },
 	{ .compatible = "arrow,xrs7004e", .data = &xrs7004e_info },
diff --git a/drivers/net/dsa/xrs700x/xrs700x_mdio.c b/drivers/net/dsa/xrs700x/xrs700x_mdio.c
index a10ee28eb86e..3b3b78f20263 100644
--- a/drivers/net/dsa/xrs700x/xrs700x_mdio.c
+++ b/drivers/net/dsa/xrs700x/xrs700x_mdio.c
@@ -138,7 +138,7 @@ static void xrs700x_mdio_remove(struct mdio_device *mdiodev)
 	xrs700x_switch_remove(priv);
 }
 
-static const struct of_device_id xrs700x_mdio_dt_ids[] = {
+static const struct of_device_id __maybe_unused xrs700x_mdio_dt_ids[] = {
 	{ .compatible = "arrow,xrs7003e", .data = &xrs7003e_info },
 	{ .compatible = "arrow,xrs7003f", .data = &xrs7003f_info },
 	{ .compatible = "arrow,xrs7004e", .data = &xrs7004e_info },
-- 
2.11.0


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

* [PATCH net-next 2/2] net: dsa: xrs700x: use of_match_ptr() on xrs700x_mdio_dt_ids
  2021-02-09 21:12 [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id George McCollister
@ 2021-02-09 21:12 ` George McCollister
  2021-02-09 21:28   ` Florian Fainelli
  2021-02-09 21:27 ` [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id Florian Fainelli
  1 sibling, 1 reply; 4+ messages in thread
From: George McCollister @ 2021-02-09 21:12 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	netdev, George McCollister

Use of_match_ptr() on xrs700x_mdio_dt_ids so that NULL is substituted
when CONFIG_OF isn't defined. This will prevent unnecessary use of
xrs700x_mdio_dt_ids when CONFIG_OF isn't defined.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
---
 drivers/net/dsa/xrs700x/xrs700x_mdio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/xrs700x/xrs700x_mdio.c b/drivers/net/dsa/xrs700x/xrs700x_mdio.c
index 3b3b78f20263..44f58bee04a4 100644
--- a/drivers/net/dsa/xrs700x/xrs700x_mdio.c
+++ b/drivers/net/dsa/xrs700x/xrs700x_mdio.c
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/phy.h>
 #include <linux/if_vlan.h>
+#include <linux/of.h>
 #include "xrs700x.h"
 #include "xrs700x_reg.h"
 
@@ -150,7 +151,7 @@ MODULE_DEVICE_TABLE(of, xrs700x_mdio_dt_ids);
 static struct mdio_driver xrs700x_mdio_driver = {
 	.mdiodrv.driver = {
 		.name	= "xrs700x-mdio",
-		.of_match_table = xrs700x_mdio_dt_ids,
+		.of_match_table = of_match_ptr(xrs700x_mdio_dt_ids),
 	},
 	.probe	= xrs700x_mdio_probe,
 	.remove	= xrs700x_mdio_remove,
-- 
2.11.0


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

* Re: [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id
  2021-02-09 21:12 [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id George McCollister
  2021-02-09 21:12 ` [PATCH net-next 2/2] net: dsa: xrs700x: use of_match_ptr() on xrs700x_mdio_dt_ids George McCollister
@ 2021-02-09 21:27 ` Florian Fainelli
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2021-02-09 21:27 UTC (permalink / raw)
  To: George McCollister, Jakub Kicinski
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, netdev

On 2/9/21 1:12 PM, George McCollister wrote:
> Fix unused variable warning that occurs when CONFIG_OF isn't defined by
> adding __maybe_unused.
> 
>>> drivers/net/dsa/xrs700x/xrs700x_i2c.c:127:34: warning: unused
> variable 'xrs700x_i2c_dt_ids' [-Wunused-const-variable]
>    static const struct of_device_id xrs700x_i2c_dt_ids[] = {
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: George McCollister <george.mccollister@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next 2/2] net: dsa: xrs700x: use of_match_ptr() on xrs700x_mdio_dt_ids
  2021-02-09 21:12 ` [PATCH net-next 2/2] net: dsa: xrs700x: use of_match_ptr() on xrs700x_mdio_dt_ids George McCollister
@ 2021-02-09 21:28   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2021-02-09 21:28 UTC (permalink / raw)
  To: George McCollister, Jakub Kicinski
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, netdev

On 2/9/21 1:12 PM, George McCollister wrote:
> Use of_match_ptr() on xrs700x_mdio_dt_ids so that NULL is substituted
> when CONFIG_OF isn't defined. This will prevent unnecessary use of
> xrs700x_mdio_dt_ids when CONFIG_OF isn't defined.
> 
> Signed-off-by: George McCollister <george.mccollister@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

end of thread, other threads:[~2021-02-09 23:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 21:12 [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id George McCollister
2021-02-09 21:12 ` [PATCH net-next 2/2] net: dsa: xrs700x: use of_match_ptr() on xrs700x_mdio_dt_ids George McCollister
2021-02-09 21:28   ` Florian Fainelli
2021-02-09 21:27 ` [PATCH net-next 1/2] net: dsa: xrs700x: fix unused warning for of_device_id Florian Fainelli

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.