diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-07-18 12:08:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-19 20:46:08 -0400 |
commit | 32aca5600526189dd876e6c92b64fd88cf052c8d (patch) | |
tree | 576e556090c39ae10c6a510c28ba3d2a75b12d5f /drivers/usb | |
parent | 82210d377468f59745303b96473e30e60b33434d (diff) |
USB: move routines in hcd.c
This patch (as939) moves a couple of routine in hcd.c around. The
purpose is to put all the general URB- and endpoint-related routines
(submit, unlink, giveback, and disable) together in one spot.
There are no functional changes.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hcd.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 963520fbef90..032b118c2883 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1033,18 +1033,6 @@ done: | |||
1033 | 1033 | ||
1034 | /*-------------------------------------------------------------------------*/ | 1034 | /*-------------------------------------------------------------------------*/ |
1035 | 1035 | ||
1036 | /* called in any context */ | ||
1037 | int usb_hcd_get_frame_number (struct usb_device *udev) | ||
1038 | { | ||
1039 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
1040 | |||
1041 | if (!HC_IS_RUNNING (hcd->state)) | ||
1042 | return -ESHUTDOWN; | ||
1043 | return hcd->driver->get_frame_number (hcd); | ||
1044 | } | ||
1045 | |||
1046 | /*-------------------------------------------------------------------------*/ | ||
1047 | |||
1048 | /* this makes the hcd giveback() the urb more quickly, by kicking it | 1036 | /* this makes the hcd giveback() the urb more quickly, by kicking it |
1049 | * off hardware queues (which may take a while) and returning it as | 1037 | * off hardware queues (which may take a while) and returning it as |
1050 | * soon as practical. we've already set up the urb's return status, | 1038 | * soon as practical. we've already set up the urb's return status, |
@@ -1167,6 +1155,35 @@ done: | |||
1167 | 1155 | ||
1168 | /*-------------------------------------------------------------------------*/ | 1156 | /*-------------------------------------------------------------------------*/ |
1169 | 1157 | ||
1158 | /** | ||
1159 | * usb_hcd_giveback_urb - return URB from HCD to device driver | ||
1160 | * @hcd: host controller returning the URB | ||
1161 | * @urb: urb being returned to the USB device driver. | ||
1162 | * Context: in_interrupt() | ||
1163 | * | ||
1164 | * This hands the URB from HCD to its USB device driver, using its | ||
1165 | * completion function. The HCD has freed all per-urb resources | ||
1166 | * (and is done using urb->hcpriv). It also released all HCD locks; | ||
1167 | * the device driver won't cause problems if it frees, modifies, | ||
1168 | * or resubmits this URB. | ||
1169 | */ | ||
1170 | void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb) | ||
1171 | { | ||
1172 | urb_unlink(hcd, urb); | ||
1173 | usbmon_urb_complete (&hcd->self, urb); | ||
1174 | usb_unanchor_urb(urb); | ||
1175 | |||
1176 | /* pass ownership to the completion handler */ | ||
1177 | urb->complete (urb); | ||
1178 | atomic_dec (&urb->use_count); | ||
1179 | if (unlikely (urb->reject)) | ||
1180 | wake_up (&usb_kill_urb_queue); | ||
1181 | usb_put_urb (urb); | ||
1182 | } | ||
1183 | EXPORT_SYMBOL (usb_hcd_giveback_urb); | ||
1184 | |||
1185 | /*-------------------------------------------------------------------------*/ | ||
1186 | |||
1170 | /* disables the endpoint: cancels any pending urbs, then synchronizes with | 1187 | /* disables the endpoint: cancels any pending urbs, then synchronizes with |
1171 | * the hcd to make sure all endpoint state is gone from hardware, and then | 1188 | * the hcd to make sure all endpoint state is gone from hardware, and then |
1172 | * waits until the endpoint's queue is completely drained. use for | 1189 | * waits until the endpoint's queue is completely drained. use for |
@@ -1260,6 +1277,18 @@ rescan: | |||
1260 | 1277 | ||
1261 | /*-------------------------------------------------------------------------*/ | 1278 | /*-------------------------------------------------------------------------*/ |
1262 | 1279 | ||
1280 | /* called in any context */ | ||
1281 | int usb_hcd_get_frame_number (struct usb_device *udev) | ||
1282 | { | ||
1283 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
1284 | |||
1285 | if (!HC_IS_RUNNING (hcd->state)) | ||
1286 | return -ESHUTDOWN; | ||
1287 | return hcd->driver->get_frame_number (hcd); | ||
1288 | } | ||
1289 | |||
1290 | /*-------------------------------------------------------------------------*/ | ||
1291 | |||
1263 | #ifdef CONFIG_PM | 1292 | #ifdef CONFIG_PM |
1264 | 1293 | ||
1265 | int hcd_bus_suspend(struct usb_device *rhdev) | 1294 | int hcd_bus_suspend(struct usb_device *rhdev) |
@@ -1395,35 +1424,6 @@ EXPORT_SYMBOL (usb_bus_start_enum); | |||
1395 | /*-------------------------------------------------------------------------*/ | 1424 | /*-------------------------------------------------------------------------*/ |
1396 | 1425 | ||
1397 | /** | 1426 | /** |
1398 | * usb_hcd_giveback_urb - return URB from HCD to device driver | ||
1399 | * @hcd: host controller returning the URB | ||
1400 | * @urb: urb being returned to the USB device driver. | ||
1401 | * Context: in_interrupt() | ||
1402 | * | ||
1403 | * This hands the URB from HCD to its USB device driver, using its | ||
1404 | * completion function. The HCD has freed all per-urb resources | ||
1405 | * (and is done using urb->hcpriv). It also released all HCD locks; | ||
1406 | * the device driver won't cause problems if it frees, modifies, | ||
1407 | * or resubmits this URB. | ||
1408 | */ | ||
1409 | void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb) | ||
1410 | { | ||
1411 | urb_unlink(hcd, urb); | ||
1412 | usbmon_urb_complete (&hcd->self, urb); | ||
1413 | usb_unanchor_urb(urb); | ||
1414 | |||
1415 | /* pass ownership to the completion handler */ | ||
1416 | urb->complete (urb); | ||
1417 | atomic_dec (&urb->use_count); | ||
1418 | if (unlikely (urb->reject)) | ||
1419 | wake_up (&usb_kill_urb_queue); | ||
1420 | usb_put_urb (urb); | ||
1421 | } | ||
1422 | EXPORT_SYMBOL (usb_hcd_giveback_urb); | ||
1423 | |||
1424 | /*-------------------------------------------------------------------------*/ | ||
1425 | |||
1426 | /** | ||
1427 | * usb_hcd_irq - hook IRQs to HCD framework (bus glue) | 1427 | * usb_hcd_irq - hook IRQs to HCD framework (bus glue) |
1428 | * @irq: the IRQ being raised | 1428 | * @irq: the IRQ being raised |
1429 | * @__hcd: pointer to the HCD whose IRQ is being signaled | 1429 | * @__hcd: pointer to the HCD whose IRQ is being signaled |