Skip to contentSkip to conversation

net: dsa: microchip: remove of_match_ptr() from ksz9477_dt_ids

PATCH In review Souptick Joarder 3 participants 6 messages Jul 27, 2022 – Jul 30, 2022

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

PATCH 1/1 net: dsa: microchip: remove of_match_ptr() from ksz9477_dt_ids

From: "Souptick Joarder (HPE)" <[email protected]>

Quoted 1 line
Quoted 1 line

drivers/net/dsa/microchip/ksz9477_i2c.c:89:34:

warning: 'ksz9477_dt_ids' defined but not used [-Wunused-const-variable=]

      89 | static const struct of_device_id ksz9477_dt_ids[] = {
         |                                  ^~~~~~~~~~~~~~

Removed of_match_ptr() from ksz9477_dt_ids.

---
 drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz9477_i2c.c +1 -1
index 99966514d444..c967a03a22c6 100644
@@ -118,7 +118,7 @@ MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
 static struct i2c_driver ksz9477_i2c_driver = {
 	.driver = {
 		.name	= "ksz9477-switch",
-		.of_match_table = of_match_ptr(ksz9477_dt_ids),
+		.of_match_table = ksz9477_dt_ids,
 	},
 	.probe	= ksz9477_i2c_probe,
 	.remove	= ksz9477_i2c_remove,
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 4 lines · Souptick Joarder

From: "Souptick Joarder (HPE)" <[email protected]>

Quoted 1 line
Quoted 1 line

drivers/net/dsa/microchip/ksz9477_i2c.c:89:34:

warning: 'ksz9477_dt_ids' defined but not used [-Wunused-const-variable=]

Quoted 8 lines
      89 | static const struct of_device_id ksz9477_dt_ids[] = {
         |                                  ^~~~~~~~~~~~~~

Removed of_match_ptr() from ksz9477_dt_ids.

---

I have to say, this is a major fail for what of_match_ptr() intended to do.

commit 3a1e362e3f3cd571b3974b8d44b8e358ec7a098c

Author: Ben Dooks <[email protected]>
Date:   Wed Aug 3 10:11:42 2011 +0100

OF: Add of_match_ptr() macro

Add a macro of_match_ptr() that allows the .of_match_table entry in the driver structures to be assigned without having an #ifdef xxx NULL for the case that OF is not enabled

Should we also depend on CONFIG_OF?

Quoted 19 lines
 drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz9477_i2c.c +1 -2
index 99966514d444..c967a03a22c6 100644
@@ -118,7 +118,7 @@ MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
 static struct i2c_driver ksz9477_i2c_driver = {
 	.driver = {
 		.name	= "ksz9477-switch",
-		.of_match_table = of_match_ptr(ksz9477_dt_ids),
+		.of_match_table = ksz9477_dt_ids,
 	},
 	.probe	= ksz9477_i2c_probe,
 	.remove	= ksz9477_i2c_remove,
--

2.25.1

#2 lore raw
Quoted 23 lines · Vladimir Oltean
Quoted 4 lines · Souptick Joarder

From: "Souptick Joarder (HPE)" <[email protected]>

Quoted 1 line
Quoted 1 line

drivers/net/dsa/microchip/ksz9477_i2c.c:89:34:

warning: 'ksz9477_dt_ids' defined but not used [-Wunused-const-variable=]

Quoted 8 lines
      89 | static const struct of_device_id ksz9477_dt_ids[] = {
         |                                  ^~~~~~~~~~~~~~

Removed of_match_ptr() from ksz9477_dt_ids.

---

I have to say, this is a major fail for what of_match_ptr() intended to do.

commit 3a1e362e3f3cd571b3974b8d44b8e358ec7a098c

Author: Ben Dooks <[email protected]>
Date:   Wed Aug 3 10:11:42 2011 +0100

OF: Add of_match_ptr() macro

Quoted 8 lines

Add a macro of_match_ptr() that allows the .of_match_table entry in the driver structures to be assigned without having an #ifdef xxx NULL for the case that OF is not enabled

Should we also depend on CONFIG_OF?

Few other drivers threw similar warnings and the suggestion was to remove of_match_ptr(). Anyway both approaches look fine.

Quoted 20 lines
Quoted 20 lines
 drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz9477_i2c.c +1 -2
index 99966514d444..c967a03a22c6 100644
@@ -118,7 +118,7 @@ MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
 static struct i2c_driver ksz9477_i2c_driver = {
      .driver = {
              .name   = "ksz9477-switch",
-             .of_match_table = of_match_ptr(ksz9477_dt_ids),
+             .of_match_table = ksz9477_dt_ids,
      },
      .probe  = ksz9477_i2c_probe,
      .remove = ksz9477_i2c_remove,
--

2.25.1

maintainer
#3 lore raw
Quoted 2 lines · Souptick Joarder

Few other drivers threw similar warnings and the suggestion was to remove of_match_ptr(). Anyway both approaches look fine.

I don't disagree with this change, I'm just saying that as a next step we may block this driver from even being compiled if CONFIG_OF=n.

maintainer
#4 lore raw
In reply to Souptick Joarder
Quoted 11 lines · Souptick Joarder

From: "Souptick Joarder (HPE)" <[email protected]>

Quoted 1 line
Quoted 1 line

drivers/net/dsa/microchip/ksz9477_i2c.c:89:34:

warning: 'ksz9477_dt_ids' defined but not used [-Wunused-const-variable=]

      89 | static const struct of_device_id ksz9477_dt_ids[] = {
         |                                  ^~~~~~~~~~~~~~

Removed of_match_ptr() from ksz9477_dt_ids.

As this looks like a fix, could you please post a new revision of the patch including into the commit message a proper 'Fixes' tag?

Thanks!

Paolo

#5 lore raw
Quoted 9 lines · Paolo Abeni
Quoted 7 lines · Souptick Joarder

From: "Souptick Joarder (HPE)" <[email protected]>

Quoted 1 line
Quoted 1 line

drivers/net/dsa/microchip/ksz9477_i2c.c:89:34:

warning: 'ksz9477_dt_ids' defined but not used [-Wunused-const-variable=]

      89 | static const struct of_device_id ksz9477_dt_ids[] = {
         |                                  ^~~~~~~~~~~~~~
Quoted 7 lines
Quoted 4 lines

Removed of_match_ptr() from ksz9477_dt_ids.

As this looks like a fix, could you please post a new revision of the patch including into the commit message a proper 'Fixes' tag?

Sure.

Quoted 5 lines

Thanks!

Paolo