Skip to content

Commit bba9f47

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: stmmac: use correct type for tx_lpi_timer
The ethtool interface uses u32 for tx_lpi_timer, and so does phylib. Use u32 to store this internally within stmmac rather than "int" which could misinterpret large values. Correct "value" in dwmac4_set_eee_lpi_entry_timer() to use u32 rather than int, which is derived from tx_lpi_timer. Even though this path won't be used with values larger than STMMAC_ET_MAX, this brings consistency of type usage to the stmmac code for this variable. We leave eee_timer unchanged for now, with the assumption that values up to INT_MAX will safely fit in a u32. Tested-by: Choong Yong Liang <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1991819 commit bba9f47

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,10 @@ static void dwmac4_set_eee_pls(struct mac_device_info *hw, int link)
420420
writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
421421
}
422422

423-
static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, int et)
423+
static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, u32 et)
424424
{
425425
void __iomem *ioaddr = hw->pcsr;
426-
int value = et & STMMAC_ET_MAX;
426+
u32 value = et & STMMAC_ET_MAX;
427427
int regval;
428428

429429
/* Program LPI entry timer value into register */

drivers/net/ethernet/stmicro/stmmac/hwif.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ struct stmmac_ops {
363363
void (*set_eee_mode)(struct mac_device_info *hw,
364364
bool en_tx_lpi_clockgating);
365365
void (*reset_eee_mode)(struct mac_device_info *hw);
366-
void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, int et);
366+
void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, u32 et);
367367
void (*set_eee_timer)(struct mac_device_info *hw, int ls, int tw);
368368
void (*set_eee_pls)(struct mac_device_info *hw, int link);
369369
void (*debug)(struct stmmac_priv *priv, void __iomem *ioaddr,

drivers/net/ethernet/stmicro/stmmac/stmmac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct stmmac_priv {
307307
int lpi_irq;
308308
int eee_enabled;
309309
int eee_active;
310-
int tx_lpi_timer;
310+
u32 tx_lpi_timer;
311311
int tx_lpi_enabled;
312312
int eee_tw_timer;
313313
bool eee_sw_timer_en;

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue)
394394

395395
static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
396396
{
397-
int tx_lpi_timer;
397+
u32 tx_lpi_timer;
398398

399399
/* Clear/set the SW EEE timer flag based on LPI ET enablement */
400400
priv->eee_sw_timer_en = en ? 0 : 1;
401-
tx_lpi_timer = en ? priv->tx_lpi_timer : 0;
401+
tx_lpi_timer = en ? priv->tx_lpi_timer : 0;
402402
stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer);
403403
}
404404

0 commit comments

Comments
 (0)