[RFC PATCH net-next v3 06/15] net: dsa: mt7530: move p5_intf_modes() function to mt7530.c

Daniel Golle posted 15 patches 1 year, 7 months ago
[RFC PATCH net-next v3 06/15] net: dsa: mt7530: move p5_intf_modes() function to mt7530.c
Posted by Daniel Golle 1 year, 7 months ago
In preparation of splitting mt7530.c into a driver for MDIO-connected
as well as MDIO-accessed built-in switches on one hand and MMIO-accessed
built-in switches move the p5_inft_modes() function from mt7530.h to
mt7530.c. The function is only needed there and will trigger a compiler
warning about a defined but unused function otherwise when including
mt7530.h in the to-be-introduced bus-specific drivers.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/dsa/mt7530.c | 18 ++++++++++++++++++
 drivers/net/dsa/mt7530.h | 18 ------------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 033e70b42b12a..221d56cf9e710 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -946,6 +946,24 @@ mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
 	return 0;
 }
 
+static const char *p5_intf_modes(unsigned int p5_interface)
+{
+	switch (p5_interface) {
+	case P5_DISABLED:
+		return "DISABLED";
+	case P5_INTF_SEL_PHY_P0:
+		return "PHY P0";
+	case P5_INTF_SEL_PHY_P4:
+		return "PHY P4";
+	case P5_INTF_SEL_GMAC5:
+		return "GMAC5";
+	case P5_INTF_SEL_GMAC5_SGMII:
+		return "GMAC5_SGMII";
+	default:
+		return "unknown";
+	}
+}
+
 static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
 {
 	struct mt7530_priv *priv = ds->priv;
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index 39aaca50961bd..2a611173a7d08 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -682,24 +682,6 @@ enum p5_interface_select {
 	P5_INTF_SEL_GMAC5_SGMII,
 };
 
-static const char *p5_intf_modes(unsigned int p5_interface)
-{
-	switch (p5_interface) {
-	case P5_DISABLED:
-		return "DISABLED";
-	case P5_INTF_SEL_PHY_P0:
-		return "PHY P0";
-	case P5_INTF_SEL_PHY_P4:
-		return "PHY P4";
-	case P5_INTF_SEL_GMAC5:
-		return "GMAC5";
-	case P5_INTF_SEL_GMAC5_SGMII:
-		return "GMAC5_SGMII";
-	default:
-		return "unknown";
-	}
-}
-
 struct mt7530_priv;
 
 struct mt753x_pcs {
-- 
2.39.2
Re: [RFC PATCH net-next v3 06/15] net: dsa: mt7530: move p5_intf_modes() function to mt7530.c
Posted by Andrew Lunn 1 year, 7 months ago
On Wed, Mar 29, 2023 at 04:58:35PM +0100, Daniel Golle wrote:
> In preparation of splitting mt7530.c into a driver for MDIO-connected
> as well as MDIO-accessed built-in switches on one hand and MMIO-accessed
> built-in switches move the p5_inft_modes() function from mt7530.h to
> mt7530.c. The function is only needed there and will trigger a compiler
> warning about a defined but unused function otherwise when including
> mt7530.h in the to-be-introduced bus-specific drivers.

The other way to avoid the warning is to mark it inline. The compiler
will not warn than. But this solution is also good.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew