瀏覽代碼

PHY: remove rwsem use from phy core

The subsystem rwsem is not used by the driver core at all, so the use of
it in the phy code doesn't make any sense.  They might possibly
want to use a local lock, but I am unsure about that.

Cc: netdev <netdev@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Greg Kroah-Hartman 18 年之前
父節點
當前提交
87aebe078e
共有 2 個文件被更改,包括 1 次插入14 次删除
  1. 0 6
      drivers/net/phy/fixed.c
  2. 1 8
      drivers/net/phy/phy_device.c

+ 0 - 6
drivers/net/phy/fixed.c

@@ -276,21 +276,15 @@ static int fixed_mdio_register_device(int number, int speed, int duplex)
 	   artificially, we are binding the driver here by hand;
 	   artificially, we are binding the driver here by hand;
 	   it will be the same for all the fixed phys anyway.
 	   it will be the same for all the fixed phys anyway.
 	 */
 	 */
-	down_write(&phydev->dev.bus->subsys.rwsem);
-
 	phydev->dev.driver = &fixed_mdio_driver.driver;
 	phydev->dev.driver = &fixed_mdio_driver.driver;
 
 
 	err = phydev->dev.driver->probe(&phydev->dev);
 	err = phydev->dev.driver->probe(&phydev->dev);
 	if(err < 0) {
 	if(err < 0) {
 		printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id);
 		printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id);
-		up_write(&phydev->dev.bus->subsys.rwsem);
 		goto probe_fail;
 		goto probe_fail;
 	}
 	}
 
 
 	err = device_bind_driver(&phydev->dev);
 	err = device_bind_driver(&phydev->dev);
-
-	up_write(&phydev->dev.bus->subsys.rwsem);
-
 	if (err)
 	if (err)
 		goto probe_fail;
 		goto probe_fail;
 
 

+ 1 - 8
drivers/net/phy/phy_device.c

@@ -208,16 +208,12 @@ struct phy_device *phy_attach(struct net_device *dev,
 	 * exist, and we should use the genphy driver. */
 	 * exist, and we should use the genphy driver. */
 	if (NULL == d->driver) {
 	if (NULL == d->driver) {
 		int err;
 		int err;
-		down_write(&d->bus->subsys.rwsem);
 		d->driver = &genphy_driver.driver;
 		d->driver = &genphy_driver.driver;
 
 
 		err = d->driver->probe(d);
 		err = d->driver->probe(d);
-
 		if (err >= 0)
 		if (err >= 0)
 			err = device_bind_driver(d);
 			err = device_bind_driver(d);
 
 
-		up_write(&d->bus->subsys.rwsem);
-
 		if (err)
 		if (err)
 			return ERR_PTR(err);
 			return ERR_PTR(err);
 	}
 	}
@@ -258,11 +254,8 @@ void phy_detach(struct phy_device *phydev)
 	 * was using the generic driver), we unbind the device
 	 * was using the generic driver), we unbind the device
 	 * from the generic driver so that there's a chance a
 	 * from the generic driver so that there's a chance a
 	 * real driver could be loaded */
 	 * real driver could be loaded */
-	if (phydev->dev.driver == &genphy_driver.driver) {
-		down_write(&phydev->dev.bus->subsys.rwsem);
+	if (phydev->dev.driver == &genphy_driver.driver)
 		device_release_driver(&phydev->dev);
 		device_release_driver(&phydev->dev);
-		up_write(&phydev->dev.bus->subsys.rwsem);
-	}
 }
 }
 EXPORT_SYMBOL(phy_detach);
 EXPORT_SYMBOL(phy_detach);