From 35b5f6b1a82b5c586e0b24c711dc6ba944e88ef1 Mon Sep 17 00:00:00 2001 From: Nate Case Date: Tue, 29 Jan 2008 10:05:09 -0600 Subject: PHYLIB: Locking fixes for PHY I/O potentially sleeping PHY read/write functions can potentially sleep (e.g., a PHY accessed via I2C). The following changes were made to account for this: * Change spin locks to mutex locks * Add a BUG_ON() to phy_read() phy_write() to warn against calling them from an interrupt context. * Use work queue for PHY state machine handling since it can potentially sleep * Change phydev lock from spinlock to mutex Signed-off-by: Nate Case Acked-by: Andy Fleming Signed-off-by: Jeff Garzik Signed-off-by: David S. Miller --- include/linux/phy.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/linux/phy.h') diff --git a/include/linux/phy.h b/include/linux/phy.h index 554836edd915..5e43ae751412 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -88,7 +88,7 @@ struct mii_bus { /* A lock to ensure that only one thing can read/write * the MDIO bus at a time */ - spinlock_t mdio_lock; + struct mutex mdio_lock; struct device *dev; @@ -284,10 +284,11 @@ struct phy_device { /* Interrupt and Polling infrastructure */ struct work_struct phy_queue; + struct work_struct state_queue; struct timer_list phy_timer; atomic_t irq_disable; - spinlock_t lock; + struct mutex lock; struct net_device *attached_dev; -- cgit v1.2.3-59-g8ed1b