Thread (11 messages) 11 messages, 7 authors, 2025-02-20

RE: [PATCH net-next 3/3] net: stmmac: "speed" passed to fix_mac_speed is an int

From: <hidden>
Date: 2025-02-19 01:10:56
Also in: imx, linux-amlogic, linux-arm-msm, linux-riscv, linux-sunxi, netdev

Hi Russell,
-----Original Message-----
From: Russell King <redacted> On Behalf Of Russell King (Oracle)
Sent: Tuesday, February 18, 2025 7:25 PM
To: netdev@vger.kernel.org
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>; Andrew Lunn
[off-list ref]; Chen-Yu Tsai [off-list ref]; David S. Miller
[off-list ref]; Drew Fustini [off-list ref]; Emil Renner
Berthing [off-list ref]; Eric Dumazet [off-list ref]; Fabio
Estevam [off-list ref]; Fu Wei [off-list ref]; Guo Ren
[off-list ref]; imx@lists.linux.dev; Jakub Kicinski
[off-list ref]; Jan Petrous [off-list ref]; Jernej Skrabec
[off-list ref]; Jerome Brunet [off-list ref]; Kevin
Hilman [off-list ref]; linux-amlogic@lists.infradead.org;
linux-arm-kernel@lists.infradead.org; linux-arm-msm@vger.kernel.org;
linux-riscv@lists.infradead.org; linux-stm32@st-md-mailman.stormreply.com;
linux-sunxi@lists.linux.dev; Martin Blumenstingl
[off-list ref]; Maxime Coquelin
[off-list ref]; Minda Chen
[off-list ref]; Neil Armstrong
[off-list ref]; iwamatsu nobuhiro(岩松 信洋 ○DITC□D
IT○OST) [off-list ref]; NXP S32 Linux Team
[off-list ref]; Paolo Abeni [off-list ref]; Pengutronix Kernel
Team [off-list ref]; Samuel Holland [off-list ref];
Sascha Hauer [off-list ref]; Shawn Guo
[off-list ref]; Vinod Koul [off-list ref]
Subject: [PATCH net-next 3/3] net: stmmac: "speed" passed to fix_mac_speed
is an int

priv->plat->fix_mac_speed() is called from stmmac_mac_link_up(), which
is passed the speed as an "int". However, fix_mac_speed() implicitly casts this
to an unsigned int. Some platform glue code print this value using %u, others
with %d. Some implicitly cast it back to an int, and others to u32.

Good practice is to use one type and only one type to represent a value being
passed around a driver.

Switch all of these over to consistently use "int" when dealing with a speed
passed from stmmac_mac_link_up(), even though the speed will always be
positive.

Signed-off-by: Russell King (Oracle) <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c    | 2 +-
Acked-by: Nobuhiro Iwamatsu <redacted>

Best regards,
  Nobuhiro 


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help