diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-11-17 17:10:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:48:34 -0500 |
commit | 9ad3d6ccf5eee285e233dbaf186369b8d477a666 (patch) | |
tree | 4ad43518e01f1b2c6513e79b318d974979041b99 /include/linux/usb.h | |
parent | 75318d2d7cab77b14c5d3dbd5e69f2680a769e16 (diff) |
[PATCH] USB: Remove USB private semaphore
This patch (as605) removes the private udev->serialize semaphore,
relying instead on the locking provided by the embedded struct device's
semaphore. The changes are confined to the core, except that the
usb_trylock_device routine now uses the return convention of
down_trylock rather than down_read_trylock (they return opposite values
for no good reason).
A couple of other associated changes are included as well:
Now that we aren't concerned about HCDs that avoid using the
hcd glue layer, usb_disconnect no longer needs to acquire the
usb_bus_lock -- that can be done by usb_remove_hcd where it
belongs.
Devices aren't locked over the same scope of code in
usb_new_device and hub_port_connect_change as they used to be.
This shouldn't cause any trouble.
Along with the preceding driver core patch, this needs a lot of testing.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 2714814ab66c..46dc0421d19e 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -329,8 +329,6 @@ struct usb_device { | |||
329 | struct usb_tt *tt; /* low/full speed dev, highspeed hub */ | 329 | struct usb_tt *tt; /* low/full speed dev, highspeed hub */ |
330 | int ttport; /* device port on that tt hub */ | 330 | int ttport; /* device port on that tt hub */ |
331 | 331 | ||
332 | struct semaphore serialize; | ||
333 | |||
334 | unsigned int toggle[2]; /* one bit for each endpoint | 332 | unsigned int toggle[2]; /* one bit for each endpoint |
335 | * ([0] = IN, [1] = OUT) */ | 333 | * ([0] = IN, [1] = OUT) */ |
336 | 334 | ||
@@ -377,11 +375,12 @@ struct usb_device { | |||
377 | extern struct usb_device *usb_get_dev(struct usb_device *dev); | 375 | extern struct usb_device *usb_get_dev(struct usb_device *dev); |
378 | extern void usb_put_dev(struct usb_device *dev); | 376 | extern void usb_put_dev(struct usb_device *dev); |
379 | 377 | ||
380 | extern void usb_lock_device(struct usb_device *udev); | 378 | /* USB device locking */ |
381 | extern int usb_trylock_device(struct usb_device *udev); | 379 | #define usb_lock_device(udev) down(&(udev)->dev.sem) |
380 | #define usb_unlock_device(udev) up(&(udev)->dev.sem) | ||
381 | #define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) | ||
382 | extern int usb_lock_device_for_reset(struct usb_device *udev, | 382 | extern int usb_lock_device_for_reset(struct usb_device *udev, |
383 | struct usb_interface *iface); | 383 | struct usb_interface *iface); |
384 | extern void usb_unlock_device(struct usb_device *udev); | ||
385 | 384 | ||
386 | /* USB port reset for device reinitialization */ | 385 | /* USB port reset for device reinitialization */ |
387 | extern int usb_reset_device(struct usb_device *dev); | 386 | extern int usb_reset_device(struct usb_device *dev); |