Skip to contentSkip to conversation

net: phy: use const char * const for phylink_an_mode_str

PATCH Applied Christian Marangi 3 participants 6 messages Nov 12 – Nov 16

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

PATCH 1/2 net: phy: use const char * const for phylink_an_mode_str

The local string array should use const char * const as reported by checkpatch.pl. Use the correct type as to mute checkpatch warning.

---
 drivers/net/phy/phylink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
index e885da1c2831..bf1962e572f8 100644
@@ -184,7 +184,7 @@ static int phylink_is_empty_linkmode(const unsigned long *linkmode)
 
 static const char *phylink_an_mode_str(unsigned int mode)
 {
-	static const char *modestr[] = {
+	static const char * const modestr[] = {
 		[MLO_AN_PHY] = "phy",
 		[MLO_AN_FIXED] = "fixed",
 		[MLO_AN_INBAND] = "inband",
Signature · 1 line
2.55.0
#1 lore raw

PATCH 2/2 net: phy: fix trivial whitespace/format issue

Running checkpatch on phylink code, points out some trivial issue with whitespace instead of tab, if-else condition with a return in the if condition and manually printing the function name instead of using __func__.

Fix all of these trivial issue to mute checkpatch warning.

---
 drivers/net/phy/phylink.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/phy/phylink.c +8 -6
index bf1962e572f8..e7734e45376c 100644
@@ -3151,7 +3151,7 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
 EXPORT_SYMBOL_GPL(phylink_ethtool_ksettings_get);
 
 static bool phylink_validate_pcs_inband_autoneg(struct phylink *pl,
-					        phy_interface_t interface,
+						phy_interface_t interface,
 						unsigned long *adv)
 {
 	unsigned int inband = phylink_inband_caps(pl, interface);
@@ -4080,12 +4080,12 @@ static int phylink_sfp_module_start(void *upstream)
 	if (pl->phydev) {
 		phy_start(pl->phydev);
 		return 0;
-	} else {
-		ret = phylink_add_sfp_mod_port(pl);
-		if (ret)
-			return ret;
 	}
 
+	ret = phylink_add_sfp_mod_port(pl);
+	if (ret)
+		return ret;
+
 	/* If the module may have a PHY but we didn't detect one we
 	 * need to configure the MAC here.
 	 */
@@ -4207,6 +4207,7 @@ void phylink_resolve_c73(struct phylink_link_state *state)
 
 	for (i = 0; i < ARRAY_SIZE(phylink_c73_priority_resolution); i++) {
 		int bit = phylink_c73_priority_resolution[i].bit;
+
 		if (linkmode_test_bit(bit, state->advertising) &&
 		    linkmode_test_bit(bit, state->lp_advertising))
 			break;
@@ -4635,7 +4636,8 @@ void phylink_replay_link_end(struct phylink *pl)
 
 	if (WARN(!test_bit(PHYLINK_DISABLE_REPLAY,
 			   &pl->phylink_disable_state),
-		 "phylink_replay_link_end() called without a prior phylink_replay_link_begin()\n"))
+		 "%s called without a prior phylink_replay_link_begin()\n",
+		 __func__))
 		return;
 
 	pl->force_major_config = true;
Signature · 1 line
2.55.0
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH net-next 2/2] net: phy: fix trivial whitespace/format issue

Quoted 8 lines · Christian Marangi

Running checkpatch on phylink code, points out some trivial issue with whitespace instead of tab, if-else condition with a return in the if condition and manually printing the function name instead of using __func__.

Fix all of these trivial issue to mute checkpatch warning.

Andrew

#4 lore raw
Quoted 8 lines · Andrew Lunn
Quoted 4 lines · Christian Marangi

The local string array should use const char * const as reported by checkpatch.pl. Use the correct type as to mute checkpatch warning.

I notice a more suited title would be to use net: phylink: ...

It's ok if I send v2 and fix the title (and keep your tag?)

Signature · 1 line
	Ansuel
#5 lore raw
In reply to Christian Marangi
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 7 lines · On Thu, 12 Nov 2026 14:13:56 +0100 you wrote:

The local string array should use const char * const as reported by checkpatch.pl. Use the correct type as to mute checkpatch warning.

---
 drivers/net/phy/phylink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [net-next,1/2] net: phy: use const char * const for phylink_an_mode_str

    https://git.kernel.org/netdev/net-next/c/5a71c5cfb6ea
  - [net-next,2/2] net: phy: fix trivial whitespace/format issue
    https://git.kernel.org/netdev/net-next/c/0b2309c0e6ac

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html