public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
@ 2024-04-02 18:33 Christophe JAILLET
  2024-04-03  8:06 ` Michael Walle
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Christophe JAILLET @ 2024-04-02 18:33 UTC (permalink / raw)
  To: Vladimir Oltean, Andrew Lunn, Florian Fainelli, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Michael Walle
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
parameters in the same order.

Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:

   int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
				  int reg, u16 val);

it is likely that the definition is the one to change.

Found with cppcheck, funcArgOrderDifferent.

Fixes: ae271547bba6 ("net: dsa: sja1105: C45 only transactions for PCS")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
index 833e55e4b961..52ddb4ef259e 100644
--- a/drivers/net/dsa/sja1105/sja1105_mdio.c
+++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
@@ -94,7 +94,7 @@ int sja1110_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
 	return tmp & 0xffff;
 }
 
-int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int reg, int mmd,
+int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd, int reg,
 			       u16 val)
 {
 	struct sja1105_mdio_private *mdio_priv = bus->priv;
-- 
2.44.0


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

* Re: [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
  2024-04-02 18:33 [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45() Christophe JAILLET
@ 2024-04-03  8:06 ` Michael Walle
  2024-04-03 11:11   ` Vladimir Oltean
  2024-04-03 11:11 ` Vladimir Oltean
  2024-04-04 11:20 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Walle @ 2024-04-03  8:06 UTC (permalink / raw)
  To: Christophe JAILLET, Vladimir Oltean, Andrew Lunn,
	Florian Fainelli, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-kernel, kernel-janitors, netdev

[-- Attachment #1: Type: text/plain, Size: 1831 bytes --]

On Tue Apr 2, 2024 at 8:33 PM CEST, Christophe JAILLET wrote:
> The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
> parameters in the same order.
>
> Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
> in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:
>
>    int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
> 				  int reg, u16 val);
>
> it is likely that the definition is the one to change.

See also "struct mii_bus":

	/** @write_c45: Perform a C45 write transfer on the bus */
	int (*write_c45)(struct mii_bus *bus, int addr, int devnum,
			 int regnum, u16 val);

>
> Found with cppcheck, funcArgOrderDifferent.
>
> Fixes: ae271547bba6 ("net: dsa: sja1105: C45 only transactions for PCS")

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> ---
>  drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
> index 833e55e4b961..52ddb4ef259e 100644
> --- a/drivers/net/dsa/sja1105/sja1105_mdio.c
> +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
> @@ -94,7 +94,7 @@ int sja1110_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
>  	return tmp & 0xffff;
>  }
>  
> -int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int reg, int mmd,
> +int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd, int reg,
>  			       u16 val)

Reviewed-by: Michael Walle <mwalle@kernel.org>

Vladimir, do you happen to know if some of your boards will use this
function? Just wondering because it was never noticed.

-michael

>  {
>  	struct sja1105_mdio_private *mdio_priv = bus->priv;


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

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

* Re: [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
  2024-04-03  8:06 ` Michael Walle
@ 2024-04-03 11:11   ` Vladimir Oltean
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2024-04-03 11:11 UTC (permalink / raw)
  To: Michael Walle
  Cc: Christophe JAILLET, Andrew Lunn, Florian Fainelli,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-kernel, kernel-janitors, netdev

On Wed, Apr 03, 2024 at 10:06:51AM +0200, Michael Walle wrote:
> Vladimir, do you happen to know if some of your boards will use this
> function? Just wondering because it was never noticed.
> 
> -michael

The SJA1110 uses the XPCS only for SGMII and 2500Base-X links. On the
Bluebox3 I have (which is currently in a cardboard box for the time
being, so I will have to rely on static analysis just like everybody
else), these links are the cascade ports between switches. However,
those cascade ports are only used for autonomous traffic bridging (the
board has a weird "H" topology). Traffic terminated on the CPU doesn't
go through the SGMII links, so this is why I haven't noticed it during
casual testing.

However, there are other NXP systems using downstream device trees which
are likely impacted, but they are on older kernels and probably haven't
seen the regression just yet. So the fix is welcome.

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

* Re: [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
  2024-04-02 18:33 [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45() Christophe JAILLET
  2024-04-03  8:06 ` Michael Walle
@ 2024-04-03 11:11 ` Vladimir Oltean
  2024-04-04 11:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2024-04-03 11:11 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Andrew Lunn, Florian Fainelli, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michael Walle, linux-kernel,
	kernel-janitors, netdev

On Tue, Apr 02, 2024 at 08:33:56PM +0200, Christophe JAILLET wrote:
> The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
> parameters in the same order.
> 
> Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
> in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:
> 
>    int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
> 				  int reg, u16 val);
> 
> it is likely that the definition is the one to change.
> 
> Found with cppcheck, funcArgOrderDifferent.
> 
> Fixes: ae271547bba6 ("net: dsa: sja1105: C45 only transactions for PCS")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

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

* Re: [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
  2024-04-02 18:33 [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45() Christophe JAILLET
  2024-04-03  8:06 ` Michael Walle
  2024-04-03 11:11 ` Vladimir Oltean
@ 2024-04-04 11:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-04 11:20 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: olteanv, andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	michael, linux-kernel, kernel-janitors, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue,  2 Apr 2024 20:33:56 +0200 you wrote:
> The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
> parameters in the same order.
> 
> Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
> in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:
> 
>    int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
> 				  int reg, u16 val);
> 
> [...]

Here is the summary with links:
  - [net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
    https://git.kernel.org/netdev/net/c/c120209bce34

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-04-04 11:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 18:33 [PATCH net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45() Christophe JAILLET
2024-04-03  8:06 ` Michael Walle
2024-04-03 11:11   ` Vladimir Oltean
2024-04-03 11:11 ` Vladimir Oltean
2024-04-04 11:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox