[PATCH 28/46] PHY: remove rwsem use from phy core

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: Greg Kroah-Hartman <gregkh@...>, netdev <netdev@...>
Date: Friday, April 27, 2007 - 2:53 pm

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>
---
 drivers/net/phy/fixed.c      |    6 ------
 drivers/net/phy/phy_device.c |    9 +--------
 2 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index 66da91b..68c99b4 100644
--- a/drivers/net/phy/fixed.c
+++ b/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;
 	   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;
 
 	err = phydev->dev.driver->probe(&phydev->dev);
 	if(err < 0) {
 		printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id);
-		up_write(&phydev->dev.bus->subsys.rwsem);
 		goto probe_fail;
 	}
 
 	err = device_bind_driver(&phydev->dev);
-
-	up_write(&phydev->dev.bus->subsys.rwsem);
-
 	if (err)
 		goto probe_fail;
 
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 7d5b6d1..8f01952 100644
--- a/drivers/net/phy/phy_device.c
+++ b/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. */
 	if (NULL == d->driver) {
 		int err;
-		down_write(&d->bus->subsys.rwsem);
 		d->driver = &genphy_driver.driver;
 
 		err = d->driver->probe(d);
-
 		if (err >= 0)
 			err = device_bind_driver(d);
 
-		up_write(&d->bus->subsys.rwsem);
-
 		if (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
 	 * from the generic driver so that there's a chance a
 	 * 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);
-		up_write(&phydev->dev.bus->subsys.rwsem);
-	}
 }
 EXPORT_SYMBOL(phy_detach);
 
-- 
1.5.1.2

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 13/46] Driver core: notify userspace of network devic..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 14/46] Driver core: suppress uevents via filter, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 15/46] Driver core: switch firmware_class to uevent_s..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 16/46] uevent: use add_uevent_var() instead of open c..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 17/46] Driver core: add suspend() and resume() to str..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 18/46] Kobject: kobject_uevent.c: Collapse unnecessar..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 19/46] kobject: kobject_add() reference leak, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 20/46] Driver core: remove use of rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 21/46] SCSI: use the proper semaphore to protect the ..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 22/46] USB: remove use of the bus rwsem, as it doesn'..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 23/46] PNP: stop using the subsystem rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 24/46] Input: serio - do not touch bus's rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 25/46] Input: gameport - do not touch bus's rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 26/46] IDE: remove rwsem use from ide-proc core, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 27/46] IEEE1394: remove rwsem use from ieee1394 core, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 28/46] PHY: remove rwsem use from phy core, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
Re: [PATCH 28/46] PHY: remove rwsem use from phy core, Andy Fleming, (Fri Apr 27, 5:11 pm)
[PATCH 29/46] qeth: Remove usage of subsys.rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 30/46] kobject core: remove rwsem from struct subsystem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 31/46] Driver core: make uevent-environment available..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 32/46] Driver core: warn when userspace writes to the..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 33/46] kobject: Comment and warning fixes to kobject.c, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 34/46] the overdue removal of the mount/umount uevents, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 35/46] debugfs: Add debugfs_create_u64(), Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 36/46] driver core: bus_add_driver should return an e..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 37/46] Driver core: use mutex instead of semaphore in..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 38/46] sysfs: bin.c printk fix, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 39/46] s390: cio: Delay uevents for subchannels, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 40/46] device_schedule_callback() needs a module refe..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 41/46] security: prevent permission checking of file ..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 42/46] define platform wakeup hook, use in pci_enable..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 43/46] s2ram: add arch irq disable/enable hooks, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 44/46] mod_sysfs_setup() doesn't return errno when ko..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 45/46] drivers/base/attribute_container.c: use mutex ..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 46/46] dev_dbg: check dev_dbg() arguments, Greg Kroah-Hartman, (Fri Apr 27, 2:54 pm)