Skip to contentSkip to conversation

net: dsa: mv88e6xxx: Fix a few build warnings

PATCH In review Florian Fainelli 2 participants 6 messages Apr 6, 2017

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

cover net: dsa: mv88e6xxx: Fix a few build warnings

Hi all,

This fixes a bunch of warnings exposed by a make W=1, no functional changes

Florian Fainelli (2):
net: dsa: mv88e6xxx: Fix warning with CONFIG_OF=n
net: dsa: mv88e6xxx: Provide prototypes for SMI read/write functions

 drivers/net/dsa/mv88e6xxx/chip.c    | 2 ++
 drivers/net/dsa/mv88e6xxx/global2.h | 9 +++++++++
 2 files changed, 11 insertions(+)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/2 net: dsa: mv88e6xxx: Fix warning with CONFIG_OF=n

When CONFIG_OF=n, we will see the following warning:

drivers/net/dsa/mv88e6xxx/chip.c:2834:34: warning: 'mv88e6xxx_mdio_external_match' defined but not used [-Wunused-const-variable=]

 static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +2 -0
index 44ba8cff5631..64cbc4c04907 100644
@@ -2831,11 +2831,13 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
 	{ .compatible = "marvell,mv88e6xxx-mdio-external",
 	  .data = (void *)true },
 	{ },
 };
+#endif
 
 static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
 				    struct device_node *np)
Signature · 1 line
2.9.3
maintainer
#2 lore raw

Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Fix warning with CONFIG_OF=n

Quoted 16 lines · Florian Fainelli

When CONFIG_OF=n, we will see the following warning:

drivers/net/dsa/mv88e6xxx/chip.c:2834:34: warning: 'mv88e6xxx_mdio_external_match' defined but not used [-Wunused-const-variable=]

 static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +0 -0
index 44ba8cff5631..64cbc4c04907 100644

drivers/net/dsa/mv88e6xxx/chip.c static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, · line 2840

Quoted 10 lines
drivers/net/dsa/mv88e6xxx/chip.c +2 -0
@@ -2831,11 +2831,13 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
 	{ .compatible = "marvell,mv88e6xxx-mdio-external",
 	  .data = (void *)true },
 	{ },
 };
+#endif

Hi Florian

Maybe a better fix is to make the stub of of_match_node() an inline function, so its parameters are used. That will fix this warning everywhere in the kernel, not just in this driver.

Andrew

#3 lore raw

Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Fix warning with CONFIG_OF=n

Quoted 20 lines · Andrew Lunn
Quoted 19 lines · Florian Fainelli

When CONFIG_OF=n, we will see the following warning:

drivers/net/dsa/mv88e6xxx/chip.c:2834:34: warning: 'mv88e6xxx_mdio_external_match' defined but not used [-Wunused-const-variable=]

 static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +0 -0
index 44ba8cff5631..64cbc4c04907 100644
@@ -2831,11 +2831,13 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
 	return 0;
 }
 
Quoted 7 lines

drivers/net/dsa/mv88e6xxx/chip.c static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip, · line 2840

Quoted 7 lines
drivers/net/dsa/mv88e6xxx/chip.c +2 -0
+#ifdef CONFIG_OF
 static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
 	{ .compatible = "marvell,mv88e6xxx-mdio-external",
 	  .data = (void *)true },
 	{ },
 };
+#endif

Hi Andrew,

Quoted 6 lines

Hi Florian

Maybe a better fix is to make the stub of of_match_node() an inline function, so its parameters are used. That will fix this warning everywhere in the kernel, not just in this driver.

Good point, this is just much better.

Thanks!

Signature · 1 line
Florian
#4 lore raw

PATCH 2/2 net: dsa: mv88e6xxx: Provide prototypes for SMI read/write functions

In reply to Florian Fainelli

Fixes the following warnings:

drivers/net/dsa/mv88e6xxx/global2.c:571:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_read_c45' [-Wmissing-prototypes]
int mv88e6xxx_g2_smi_phy_read_c45(struct mv88e6xxx_chip *chip, int addr,

     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/global2.c:602:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_read_c22' [-Wmissing-prototypes]
 int mv88e6xxx_g2_smi_phy_read_c22(struct mv88e6xxx_chip *chip, int addr,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/global2.c:635:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_write_c45' [-Wmissing-prototypes]
 int mv88e6xxx_g2_smi_phy_write_c45(struct mv88e6xxx_chip *chip, int addr,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/global2.c:664:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_write_c22' [-Wmissing-prototypes]
 int mv88e6xxx_g2_smi_phy_write_c22(struct mv88e6xxx_chip *chip, int addr,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/net/dsa/mv88e6xxx/global2.h | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/dsa/mv88e6xxx/global2.h +9 -0
index 96046bb12ca1..9b790809f327 100644
@@ -42,6 +42,15 @@ int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip,
 int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip,
 			      struct ethtool_eeprom *eeprom, u8 *data);
 
+int mv88e6xxx_g2_smi_phy_read_c45(struct mv88e6xxx_chip *chip, int addr,
+				  int reg_c45, u16 *val, bool external);
+int mv88e6xxx_g2_smi_phy_write_c45(struct mv88e6xxx_chip *chip, int addr,
+				   int reg_c45, u16 val, bool external);
+int mv88e6xxx_g2_smi_phy_read_c22(struct mv88e6xxx_chip *chip, int addr,
+				  int reg, u16 *val, bool external);
+int mv88e6xxx_g2_smi_phy_write_c22(struct mv88e6xxx_chip *chip, int addr,
+				   int reg, u16 val, bool external);
+
 int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev,
 			   int src_port, u16 data);
 int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip);
Signature · 1 line
2.9.3
maintainer
#5 lore raw

Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: Provide prototypes for SMI read/write functions

Quoted 4 lines · Florian Fainelli

Fixes the following warnings:

drivers/net/dsa/mv88e6xxx/global2.c:571:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_read_c45' [-Wmissing-prototypes]
int mv88e6xxx_g2_smi_phy_read_c45(struct mv88e6xxx_chip *chip, int addr,

Quoted 10 lines
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/global2.c:602:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_read_c22' [-Wmissing-prototypes]
 int mv88e6xxx_g2_smi_phy_read_c22(struct mv88e6xxx_chip *chip, int addr,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/global2.c:635:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_write_c45' [-Wmissing-prototypes]
 int mv88e6xxx_g2_smi_phy_write_c45(struct mv88e6xxx_chip *chip, int addr,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/global2.c:664:5: warning: no previous prototype for 'mv88e6xxx_g2_smi_phy_write_c22' [-Wmissing-prototypes]
 int mv88e6xxx_g2_smi_phy_write_c22(struct mv88e6xxx_chip *chip, int addr,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Florian

These are not used outside of global2.c. So just mark them static.

Andrew