summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/mdio-mux.c
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-04-11 21:40:05 +0200
committerDavid S. Miller <davem@davemloft.net>2016-04-12 03:15:48 +0200
commit9a6f2b0113c8fce815db7c9d23754bdea4b428a0 (patch)
tree05e5b4205fb6aebdcf105fa8866cfeceeec93ff9 /drivers/net/phy/mdio-mux.c
parentMerge branch 'rprpc-2nd-rewrite-part-1' (diff)
downloadlinux-9a6f2b0113c8fce815db7c9d23754bdea4b428a0.tar.xz
linux-9a6f2b0113c8fce815db7c9d23754bdea4b428a0.zip
net: mdio: Fix lockdep falls positive splat
MDIO devices can be stacked upon each other. The current code supports two levels, which until recently has been enough for a DSA mdio bus on top of another bus. Now we have hardware which has an MDIO mux in the middle. Define an MDIO MUTEX class with three levels. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio-mux.c')
-rw-r--r--drivers/net/phy/mdio-mux.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 308ade0eb1b6..5c81d6faf304 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -45,13 +45,7 @@ static int mdio_mux_read(struct mii_bus *bus, int phy_id, int regnum)
struct mdio_mux_parent_bus *pb = cb->parent;
int r;
- /* In theory multiple mdio_mux could be stacked, thus creating
- * more than a single level of nesting. But in practice,
- * SINGLE_DEPTH_NESTING will cover the vast majority of use
- * cases. We use it, instead of trying to handle the general
- * case.
- */
- mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING);
+ mutex_lock_nested(&pb->mii_bus->mdio_lock, MDIO_MUTEX_MUX);
r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data);
if (r)
goto out;
@@ -76,7 +70,7 @@ static int mdio_mux_write(struct mii_bus *bus, int phy_id,
int r;
- mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING);
+ mutex_lock_nested(&pb->mii_bus->mdio_lock, MDIO_MUTEX_MUX);
r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data);
if (r)
goto out;