Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
32aca560 82210d37

+41 -41
+41 -41
drivers/usb/core/hcd.c
··· 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 1036 /* this makes the hcd giveback() the urb more quickly, by kicking it 1049 1037 * off hardware queues (which may take a while) and returning it as 1050 1038 * soon as practical. we've already set up the urb's return status, ··· 1155 1167 1156 1168 /*-------------------------------------------------------------------------*/ 1157 1169 1170 + /** 1171 + * usb_hcd_giveback_urb - return URB from HCD to device driver 1172 + * @hcd: host controller returning the URB 1173 + * @urb: urb being returned to the USB device driver. 1174 + * Context: in_interrupt() 1175 + * 1176 + * This hands the URB from HCD to its USB device driver, using its 1177 + * completion function. The HCD has freed all per-urb resources 1178 + * (and is done using urb->hcpriv). It also released all HCD locks; 1179 + * the device driver won't cause problems if it frees, modifies, 1180 + * or resubmits this URB. 1181 + */ 1182 + void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb) 1183 + { 1184 + urb_unlink(hcd, urb); 1185 + usbmon_urb_complete (&hcd->self, urb); 1186 + usb_unanchor_urb(urb); 1187 + 1188 + /* pass ownership to the completion handler */ 1189 + urb->complete (urb); 1190 + atomic_dec (&urb->use_count); 1191 + if (unlikely (urb->reject)) 1192 + wake_up (&usb_kill_urb_queue); 1193 + usb_put_urb (urb); 1194 + } 1195 + EXPORT_SYMBOL (usb_hcd_giveback_urb); 1196 + 1197 + /*-------------------------------------------------------------------------*/ 1198 + 1158 1199 /* disables the endpoint: cancels any pending urbs, then synchronizes with 1159 1200 * the hcd to make sure all endpoint state is gone from hardware, and then 1160 1201 * waits until the endpoint's queue is completely drained. use for ··· 1273 1256 usb_put_urb (urb); 1274 1257 } 1275 1258 } 1259 + } 1260 + 1261 + /*-------------------------------------------------------------------------*/ 1262 + 1263 + /* called in any context */ 1264 + int usb_hcd_get_frame_number (struct usb_device *udev) 1265 + { 1266 + struct usb_hcd *hcd = bus_to_hcd(udev->bus); 1267 + 1268 + if (!HC_IS_RUNNING (hcd->state)) 1269 + return -ESHUTDOWN; 1270 + return hcd->driver->get_frame_number (hcd); 1276 1271 } 1277 1272 1278 1273 /*-------------------------------------------------------------------------*/ ··· 1420 1391 EXPORT_SYMBOL (usb_bus_start_enum); 1421 1392 1422 1393 #endif 1423 - 1424 - /*-------------------------------------------------------------------------*/ 1425 - 1426 - /** 1427 - * usb_hcd_giveback_urb - return URB from HCD to device driver 1428 - * @hcd: host controller returning the URB 1429 - * @urb: urb being returned to the USB device driver. 1430 - * Context: in_interrupt() 1431 - * 1432 - * This hands the URB from HCD to its USB device driver, using its 1433 - * completion function. The HCD has freed all per-urb resources 1434 - * (and is done using urb->hcpriv). It also released all HCD locks; 1435 - * the device driver won't cause problems if it frees, modifies, 1436 - * or resubmits this URB. 1437 - */ 1438 - void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb) 1439 - { 1440 - urb_unlink(hcd, urb); 1441 - usbmon_urb_complete (&hcd->self, urb); 1442 - usb_unanchor_urb(urb); 1443 - 1444 - /* pass ownership to the completion handler */ 1445 - urb->complete (urb); 1446 - atomic_dec (&urb->use_count); 1447 - if (unlikely (urb->reject)) 1448 - wake_up (&usb_kill_urb_queue); 1449 - usb_put_urb (urb); 1450 - } 1451 - EXPORT_SYMBOL (usb_hcd_giveback_urb); 1452 1394 1453 1395 /*-------------------------------------------------------------------------*/ 1454 1396