aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 15:58:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 15:58:54 -0400
commitd868772fff6c4b881d66af8640251714e1aefa98 (patch)
treec95a68d358d5c875d25763ffe9a44fe9f2081f34 /drivers/usb
parenta205752d1ad2d37d6597aaae5a56fc396a770868 (diff)
parent404d5b185b4eb56d6fa2f7bd27833f8df1c38ce4 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (46 commits) dev_dbg: check dev_dbg() arguments drivers/base/attribute_container.c: use mutex instead of binary semaphore mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs s2ram: add arch irq disable/enable hooks define platform wakeup hook, use in pci_enable_wake() security: prevent permission checking of file removal via sysfs_remove_group() device_schedule_callback() needs a module reference s390: cio: Delay uevents for subchannels sysfs: bin.c printk fix Driver core: use mutex instead of semaphore in DMA pool handler driver core: bus_add_driver should return an error if no bus debugfs: Add debugfs_create_u64() the overdue removal of the mount/umount uevents kobject: Comment and warning fixes to kobject.c Driver core: warn when userspace writes to the uevent file in a non-supported way Driver core: make uevent-environment available in uevent-file kobject core: remove rwsem from struct subsystem qeth: Remove usage of subsys.rwsem PHY: remove rwsem use from phy core IEEE1394: remove rwsem use from ieee1394 core ...
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devices.c2
-rw-r--r--drivers/usb/core/devio.c13
-rw-r--r--drivers/usb/core/driver.c12
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/usb/core/message.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c6
6 files changed, 8 insertions, 31 deletions
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index aefc7987120d..6753ca059ee4 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -246,7 +246,6 @@ static char *usb_dump_interface_descriptor(char *start, char *end,
246 246
247 if (start > end) 247 if (start > end)
248 return start; 248 return start;
249 down_read(&usb_bus_type.subsys.rwsem);
250 if (iface) { 249 if (iface) {
251 driver_name = (iface->dev.driver 250 driver_name = (iface->dev.driver
252 ? iface->dev.driver->name 251 ? iface->dev.driver->name
@@ -263,7 +262,6 @@ static char *usb_dump_interface_descriptor(char *start, char *end,
263 desc->bInterfaceSubClass, 262 desc->bInterfaceSubClass,
264 desc->bInterfaceProtocol, 263 desc->bInterfaceProtocol,
265 driver_name); 264 driver_name);
266 up_read(&usb_bus_type.subsys.rwsem);
267 return start; 265 return start;
268} 266}
269 267
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 36e7a843bf91..fc3545ddb06e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -421,14 +421,11 @@ static int claimintf(struct dev_state *ps, unsigned int ifnum)
421 if (test_bit(ifnum, &ps->ifclaimed)) 421 if (test_bit(ifnum, &ps->ifclaimed))
422 return 0; 422 return 0;
423 423
424 /* lock against other changes to driver bindings */
425 down_write(&usb_bus_type.subsys.rwsem);
426 intf = usb_ifnum_to_if(dev, ifnum); 424 intf = usb_ifnum_to_if(dev, ifnum);
427 if (!intf) 425 if (!intf)
428 err = -ENOENT; 426 err = -ENOENT;
429 else 427 else
430 err = usb_driver_claim_interface(&usbfs_driver, intf, ps); 428 err = usb_driver_claim_interface(&usbfs_driver, intf, ps);
431 up_write(&usb_bus_type.subsys.rwsem);
432 if (err == 0) 429 if (err == 0)
433 set_bit(ifnum, &ps->ifclaimed); 430 set_bit(ifnum, &ps->ifclaimed);
434 return err; 431 return err;
@@ -444,8 +441,6 @@ static int releaseintf(struct dev_state *ps, unsigned int ifnum)
444 if (ifnum >= 8*sizeof(ps->ifclaimed)) 441 if (ifnum >= 8*sizeof(ps->ifclaimed))
445 return err; 442 return err;
446 dev = ps->dev; 443 dev = ps->dev;
447 /* lock against other changes to driver bindings */
448 down_write(&usb_bus_type.subsys.rwsem);
449 intf = usb_ifnum_to_if(dev, ifnum); 444 intf = usb_ifnum_to_if(dev, ifnum);
450 if (!intf) 445 if (!intf)
451 err = -ENOENT; 446 err = -ENOENT;
@@ -453,7 +448,6 @@ static int releaseintf(struct dev_state *ps, unsigned int ifnum)
453 usb_driver_release_interface(&usbfs_driver, intf); 448 usb_driver_release_interface(&usbfs_driver, intf);
454 err = 0; 449 err = 0;
455 } 450 }
456 up_write(&usb_bus_type.subsys.rwsem);
457 return err; 451 return err;
458} 452}
459 453
@@ -813,7 +807,6 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg)
813 807
814 if (copy_from_user(&gd, arg, sizeof(gd))) 808 if (copy_from_user(&gd, arg, sizeof(gd)))
815 return -EFAULT; 809 return -EFAULT;
816 down_read(&usb_bus_type.subsys.rwsem);
817 intf = usb_ifnum_to_if(ps->dev, gd.interface); 810 intf = usb_ifnum_to_if(ps->dev, gd.interface);
818 if (!intf || !intf->dev.driver) 811 if (!intf || !intf->dev.driver)
819 ret = -ENODATA; 812 ret = -ENODATA;
@@ -822,7 +815,6 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg)
822 sizeof(gd.driver)); 815 sizeof(gd.driver));
823 ret = (copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0); 816 ret = (copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0);
824 } 817 }
825 up_read(&usb_bus_type.subsys.rwsem);
826 return ret; 818 return ret;
827} 819}
828 820
@@ -1351,15 +1343,12 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
1351 1343
1352 /* disconnect kernel driver from interface */ 1344 /* disconnect kernel driver from interface */
1353 case USBDEVFS_DISCONNECT: 1345 case USBDEVFS_DISCONNECT:
1354
1355 down_write(&usb_bus_type.subsys.rwsem);
1356 if (intf->dev.driver) { 1346 if (intf->dev.driver) {
1357 driver = to_usb_driver(intf->dev.driver); 1347 driver = to_usb_driver(intf->dev.driver);
1358 dev_dbg (&intf->dev, "disconnect by usbfs\n"); 1348 dev_dbg (&intf->dev, "disconnect by usbfs\n");
1359 usb_driver_release_interface(driver, intf); 1349 usb_driver_release_interface(driver, intf);
1360 } else 1350 } else
1361 retval = -ENODATA; 1351 retval = -ENODATA;
1362 up_write(&usb_bus_type.subsys.rwsem);
1363 break; 1352 break;
1364 1353
1365 /* let kernel drivers try to (re)bind to the interface */ 1354 /* let kernel drivers try to (re)bind to the interface */
@@ -1371,7 +1360,6 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
1371 1360
1372 /* talk directly to the interface's driver */ 1361 /* talk directly to the interface's driver */
1373 default: 1362 default:
1374 down_read(&usb_bus_type.subsys.rwsem);
1375 if (intf->dev.driver) 1363 if (intf->dev.driver)
1376 driver = to_usb_driver(intf->dev.driver); 1364 driver = to_usb_driver(intf->dev.driver);
1377 if (driver == NULL || driver->ioctl == NULL) { 1365 if (driver == NULL || driver->ioctl == NULL) {
@@ -1381,7 +1369,6 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
1381 if (retval == -ENOIOCTLCMD) 1369 if (retval == -ENOIOCTLCMD)
1382 retval = -ENOTTY; 1370 retval = -ENOTTY;
1383 } 1371 }
1384 up_read(&usb_bus_type.subsys.rwsem);
1385 } 1372 }
1386 1373
1387 /* cleanup and return */ 1374 /* cleanup and return */
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 9e3e943f313c..e6dd2b9210f6 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -287,9 +287,9 @@ static int usb_unbind_interface(struct device *dev)
287 * way to bind to an interface is to return the private data from 287 * way to bind to an interface is to return the private data from
288 * the driver's probe() method. 288 * the driver's probe() method.
289 * 289 *
290 * Callers must own the device lock and the driver model's usb_bus_type.subsys 290 * Callers must own the device lock, so driver probe() entries don't need
291 * writelock. So driver probe() entries don't need extra locking, 291 * extra locking, but other call contexts may need to explicitly claim that
292 * but other call contexts may need to explicitly claim those locks. 292 * lock.
293 */ 293 */
294int usb_driver_claim_interface(struct usb_driver *driver, 294int usb_driver_claim_interface(struct usb_driver *driver,
295 struct usb_interface *iface, void* priv) 295 struct usb_interface *iface, void* priv)
@@ -330,9 +330,9 @@ EXPORT_SYMBOL(usb_driver_claim_interface);
330 * also causes the driver disconnect() method to be called. 330 * also causes the driver disconnect() method to be called.
331 * 331 *
332 * This call is synchronous, and may not be used in an interrupt context. 332 * This call is synchronous, and may not be used in an interrupt context.
333 * Callers must own the device lock and the driver model's usb_bus_type.subsys 333 * Callers must own the device lock, so driver disconnect() entries don't
334 * writelock. So driver disconnect() entries don't need extra locking, 334 * need extra locking, but other call contexts may need to explicitly claim
335 * but other call contexts may need to explicitly claim those locks. 335 * that lock.
336 */ 336 */
337void usb_driver_release_interface(struct usb_driver *driver, 337void usb_driver_release_interface(struct usb_driver *driver,
338 struct usb_interface *iface) 338 struct usb_interface *iface)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b89a98e61323..7a6028599d62 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -119,8 +119,7 @@ MODULE_PARM_DESC(use_both_schemes,
119 "first one fails"); 119 "first one fails");
120 120
121 121
122#ifdef DEBUG 122static inline char *portspeed(int portstatus)
123static inline char *portspeed (int portstatus)
124{ 123{
125 if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED)) 124 if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED))
126 return "480 Mb/s"; 125 return "480 Mb/s";
@@ -129,7 +128,6 @@ static inline char *portspeed (int portstatus)
129 else 128 else
130 return "12 Mb/s"; 129 return "12 Mb/s";
131} 130}
132#endif
133 131
134/* Note that hdev or one of its children must be locked! */ 132/* Note that hdev or one of its children must be locked! */
135static inline struct usb_hub *hdev_to_hub(struct usb_device *hdev) 133static inline struct usb_hub *hdev_to_hub(struct usb_device *hdev)
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 217a3d6d0a06..c359ccb32998 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1349,7 +1349,7 @@ static void release_interface(struct device *dev)
1349 * 1349 *
1350 * This call is synchronous. The calling context must be able to sleep, 1350 * This call is synchronous. The calling context must be able to sleep,
1351 * must own the device lock, and must not hold the driver model's USB 1351 * must own the device lock, and must not hold the driver model's USB
1352 * bus rwsem; usb device driver probe() methods cannot use this routine. 1352 * bus mutex; usb device driver probe() methods cannot use this routine.
1353 * 1353 *
1354 * Returns zero on success, or else the status code returned by the 1354 * Returns zero on success, or else the status code returned by the
1355 * underlying call that failed. On successful completion, each interface 1355 * underlying call that failed. On successful completion, each interface
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index f0d29eda3c6d..e8bbe8bc2598 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -486,9 +486,6 @@ static int ohci_run (struct ohci_hcd *ohci)
486 * or if bus glue did the same (e.g. for PCI add-in cards with 486 * or if bus glue did the same (e.g. for PCI add-in cards with
487 * PCI PM support). 487 * PCI PM support).
488 */ 488 */
489 ohci_dbg (ohci, "resetting from state '%s', control = 0x%x\n",
490 hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
491 ohci_readl (ohci, &ohci->regs->control));
492 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0 489 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0
493 && !device_may_wakeup(hcd->self.controller)) 490 && !device_may_wakeup(hcd->self.controller))
494 device_init_wakeup(hcd->self.controller, 1); 491 device_init_wakeup(hcd->self.controller, 1);
@@ -744,9 +741,6 @@ static void ohci_stop (struct usb_hcd *hcd)
744{ 741{
745 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 742 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
746 743
747 ohci_dbg (ohci, "stop %s controller (state 0x%02x)\n",
748 hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
749 hcd->state);
750 ohci_dump (ohci, 1); 744 ohci_dump (ohci, 1);
751 745
752 flush_scheduled_work(); 746 flush_scheduled_work();