ChangeSet 1.994.1.3, 2003/03/28 14:16:14-08:00, oliver@neukum.org

[PATCH] USB: leave usage counts during probe/remove to driver core

driver core protects us with semaphores during probe/disconnect. We can
stop messing with the module usage counts.


 drivers/usb/core/usb.c |   18 ------------------
 1 files changed, 18 deletions(-)


diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	Mon Apr  7 15:15:30 2003
+++ b/drivers/usb/core/usb.c	Mon Apr  7 15:15:30 2003
@@ -89,11 +89,6 @@
 	if (!driver->probe)
 		return error;
 
-	if (!try_module_get(driver->owner)) {
-		dev_err (dev, "Can't get a module reference for %s\n", driver->name);
-		return error;
-	}
-
 	id = usb_match_id (intf, driver->id_table);
 	if (id) {
 		dev_dbg (dev, "%s - got id\n", __FUNCTION__);
@@ -104,8 +99,6 @@
 	if (!error)
 		intf->driver = driver;
 
-	module_put(driver->owner);
-
 	return error;
 }
 
@@ -123,16 +116,6 @@
 		return -ENODEV;
 	}
 
-	if (!try_module_get(driver->owner)) {
-		// FIXME this happens even when we just rmmod
-		// drivers that aren't in active use...
-		dev_err(dev, "Dieing driver still bound to device.\n");
-		return -EIO;
-	}
-
-	/* if we sleep here on an umanaged driver 
-	 * the holder of the lock guards against 
-	 * module unload */
 	down(&driver->serialize);
 
 	if (intf->driver && intf->driver->disconnect)
@@ -143,7 +126,6 @@
 		usb_driver_release_interface(driver, intf);
 
 	up(&driver->serialize);
-	module_put(driver->owner);
 
 	return 0;
 }
