Message ID | 20231027065741.534971-1-alexander.sverdlin@siemens.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 5a22fbcc10f3f7d94c5d88afbbffa240a3677057 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: dsa: lan9303: consequently nested-lock physical MDIO | expand |
On Fri, Oct 27, 2023 at 08:57:38AM +0200, A. Sverdlin wrote: > From: Alexander Sverdlin <alexander.sverdlin@siemens.com> > > When LAN9303 is MDIO-connected two callchains exist into > mdio->bus->write(): > > 1. switch ports 1&2 ("physical" PHYs): > > virtual (switch-internal) MDIO bus (lan9303_switch_ops->phy_{read|write})-> > lan9303_mdio_phy_{read|write} -> mdiobus_{read|write}_nested > > 2. LAN9303 virtual PHY: > > virtual MDIO bus (lan9303_phy_{read|write}) -> > lan9303_virt_phy_reg_{read|write} -> regmap -> lan9303_mdio_{read|write} > Cc: stable@vger.kernel.org > Fixes: dc7005831523 ("net: dsa: LAN9303: add MDIO managed mode support") > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
Hello: This patch was applied to netdev/net.git (main) by Paolo Abeni <pabeni@redhat.com>: On Fri, 27 Oct 2023 08:57:38 +0200 you wrote: > From: Alexander Sverdlin <alexander.sverdlin@siemens.com> > > When LAN9303 is MDIO-connected two callchains exist into > mdio->bus->write(): > > 1. switch ports 1&2 ("physical" PHYs): > > [...] Here is the summary with links: - net: dsa: lan9303: consequently nested-lock physical MDIO https://git.kernel.org/netdev/net/c/5a22fbcc10f3 You are awesome, thank you!
diff --git a/drivers/net/dsa/lan9303_mdio.c b/drivers/net/dsa/lan9303_mdio.c index d8ab2b77d201..167a86f39f27 100644 --- a/drivers/net/dsa/lan9303_mdio.c +++ b/drivers/net/dsa/lan9303_mdio.c @@ -32,7 +32,7 @@ static int lan9303_mdio_write(void *ctx, uint32_t reg, uint32_t val) struct lan9303_mdio *sw_dev = (struct lan9303_mdio *)ctx; reg <<= 2; /* reg num to offset */ - mutex_lock(&sw_dev->device->bus->mdio_lock); + mutex_lock_nested(&sw_dev->device->bus->mdio_lock, MDIO_MUTEX_NESTED); lan9303_mdio_real_write(sw_dev->device, reg, val & 0xffff); lan9303_mdio_real_write(sw_dev->device, reg + 2, (val >> 16) & 0xffff); mutex_unlock(&sw_dev->device->bus->mdio_lock); @@ -50,7 +50,7 @@ static int lan9303_mdio_read(void *ctx, uint32_t reg, uint32_t *val) struct lan9303_mdio *sw_dev = (struct lan9303_mdio *)ctx; reg <<= 2; /* reg num to offset */ - mutex_lock(&sw_dev->device->bus->mdio_lock); + mutex_lock_nested(&sw_dev->device->bus->mdio_lock, MDIO_MUTEX_NESTED); *val = lan9303_mdio_real_read(sw_dev->device, reg); *val |= (lan9303_mdio_real_read(sw_dev->device, reg + 2) << 16); mutex_unlock(&sw_dev->device->bus->mdio_lock);