mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-01 00:02:19 -04:00
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 <yong.liang.choong@linux.intel.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1tVZDc-0002Jx-3b@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
1991819deb
commit
bba9f47655
@@ -420,10 +420,10 @@ static void dwmac4_set_eee_pls(struct mac_device_info *hw, int link)
|
||||
writel(value, ioaddr + GMAC4_LPI_CTRL_STATUS);
|
||||
}
|
||||
|
||||
static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, int et)
|
||||
static void dwmac4_set_eee_lpi_entry_timer(struct mac_device_info *hw, u32 et)
|
||||
{
|
||||
void __iomem *ioaddr = hw->pcsr;
|
||||
int value = et & STMMAC_ET_MAX;
|
||||
u32 value = et & STMMAC_ET_MAX;
|
||||
int regval;
|
||||
|
||||
/* Program LPI entry timer value into register */
|
||||
|
||||
@@ -363,7 +363,7 @@ struct stmmac_ops {
|
||||
void (*set_eee_mode)(struct mac_device_info *hw,
|
||||
bool en_tx_lpi_clockgating);
|
||||
void (*reset_eee_mode)(struct mac_device_info *hw);
|
||||
void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, int et);
|
||||
void (*set_eee_lpi_entry_timer)(struct mac_device_info *hw, u32 et);
|
||||
void (*set_eee_timer)(struct mac_device_info *hw, int ls, int tw);
|
||||
void (*set_eee_pls)(struct mac_device_info *hw, int link);
|
||||
void (*debug)(struct stmmac_priv *priv, void __iomem *ioaddr,
|
||||
|
||||
@@ -307,7 +307,7 @@ struct stmmac_priv {
|
||||
int lpi_irq;
|
||||
int eee_enabled;
|
||||
int eee_active;
|
||||
int tx_lpi_timer;
|
||||
u32 tx_lpi_timer;
|
||||
int tx_lpi_enabled;
|
||||
int eee_tw_timer;
|
||||
bool eee_sw_timer_en;
|
||||
|
||||
@@ -394,11 +394,11 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue)
|
||||
|
||||
static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)
|
||||
{
|
||||
int tx_lpi_timer;
|
||||
u32 tx_lpi_timer;
|
||||
|
||||
/* Clear/set the SW EEE timer flag based on LPI ET enablement */
|
||||
priv->eee_sw_timer_en = en ? 0 : 1;
|
||||
tx_lpi_timer = en ? priv->tx_lpi_timer : 0;
|
||||
tx_lpi_timer = en ? priv->tx_lpi_timer : 0;
|
||||
stmmac_set_eee_lpi_timer(priv, priv->hw, tx_lpi_timer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user