]> www.infradead.org Git - users/hch/misc.git/commit
net: stmmac: move priv->eee_enabled into stmmac_eee_init()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 8 Jan 2025 16:48:30 +0000 (16:48 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 11 Jan 2025 01:51:02 +0000 (17:51 -0800)
commit0a900ea89a0cdf2a09e987663192ab5e0a28544e
tree36728cbbbdb5ae44f405763858977172b3cae7cc
parent2914a5cd811ac0f4e7c3b5db5a5d43041636f8dc
net: stmmac: move priv->eee_enabled into stmmac_eee_init()

All call sites for stmmac_eee_init() assign the return code to
priv->eee_enabled. Rather than having this coded at each call site,
move the assignment inside stmmac_eee_init().

Since stmmac_init_eee() takes priv->lock before checking the state of
priv->eee_enabled, move the assignment within the locked region. Also,
stmmac_suspend() checks the state of this member under the lock. While
two concurrent calls to stmmac_init_eee() aren't possible, there is
a possibility that stmmac_suspend() may run concurrently with a change
of priv->eee_enabled unless we modify it under the lock.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
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/E1tVZEM-0002Kq-2Z@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c