···162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */163164 struct device dev; /* interface specific device info */165- struct device *usb_dev; /* pointer to the usb class's device, if any */166 int pm_usage_cnt; /* usage counter for autosuspend */167};168#define to_usb_interface(d) container_of(d, struct usb_interface, dev)169#define interface_to_usbdev(intf) \170 container_of(intf->dev.parent, struct usb_device, dev)171172-static inline void *usb_get_intfdata (struct usb_interface *intf)173{174- return dev_get_drvdata (&intf->dev);175}176177-static inline void usb_set_intfdata (struct usb_interface *intf, void *data)178{179 dev_set_drvdata(&intf->dev, data);180}···275276int __usb_get_extra_descriptor(char *buffer, unsigned size,277 unsigned char type, void **ptr);278-#define usb_get_extra_descriptor(ifpoint,type,ptr)\279- __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\280- type,(void**)ptr)0281282/* ----------------------------------------------------------------------- */283···389 unsigned can_submit:1; /* URBs may be submitted */390 unsigned discon_suspended:1; /* Disconnected while suspended */391 unsigned have_langid:1; /* whether string_langid is valid */392- unsigned authorized:1; /* Policy has determined we can use it */393 unsigned wusb:1; /* Device is Wireless USB */394 int string_langid; /* language ID for strings */395···418419 int pm_usage_cnt; /* usage counter for autosuspend */420 u32 quirks; /* quirks of the whole device */421- atomic_t urbnum; /* number of URBs submitted for the whole device */0422423 unsigned long active_duration; /* total time device is not suspended */424···503/*-------------------------------------------------------------------------*/504505/* for drivers using iso endpoints */506-extern int usb_get_current_frame_number (struct usb_device *usb_dev);507508/* used these for multi-interface device registration */509extern int usb_driver_claim_interface(struct usb_driver *driver,510- struct usb_interface *iface, void* priv);511512/**513 * usb_interface_claimed - returns true iff an interface is claimed···519 * may need to explicitly claim that lock.520 *521 */522-static inline int usb_interface_claimed(struct usb_interface *iface) {0523 return (iface->dev.driver != NULL);524}525···563 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are564 * high speed, and a different one if they are full or low speed.565 */566-static inline int usb_make_path (struct usb_device *dev, char *buf,567- size_t size)568{569 int actual;570- actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name,571- dev->devpath);572 return (actual >= (int)size) ? -1 : actual;573}574···613 *614 * Returns true if the endpoint is of type OUT, otherwise it returns false.615 */616-static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)0617{618 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);619}···625 *626 * Returns true if the endpoint is of type bulk, otherwise it returns false.627 */628-static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)0629{630 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==631 USB_ENDPOINT_XFER_BULK);···638 *639 * Returns true if the endpoint is of type control, otherwise it returns false.640 */641-static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd)0642{643 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==644 USB_ENDPOINT_XFER_CONTROL);···652 * Returns true if the endpoint is of type interrupt, otherwise it returns653 * false.654 */655-static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)0656{657 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==658 USB_ENDPOINT_XFER_INT);···666 * Returns true if the endpoint is of type isochronous, otherwise it returns667 * false.668 */669-static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)0670{671 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==672 USB_ENDPOINT_XFER_ISOC);···680 * Returns true if the endpoint has bulk transfer type and IN direction,681 * otherwise it returns false.682 */683-static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)0684{685 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));686}···693 * Returns true if the endpoint has bulk transfer type and OUT direction,694 * otherwise it returns false.695 */696-static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)0697{698 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));699}···706 * Returns true if the endpoint has interrupt transfer type and IN direction,707 * otherwise it returns false.708 */709-static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)0710{711 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));712}···719 * Returns true if the endpoint has interrupt transfer type and OUT direction,720 * otherwise it returns false.721 */722-static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd)0723{724 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));725}···732 * Returns true if the endpoint has isochronous transfer type and IN direction,733 * otherwise it returns false.734 */735-static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd)0736{737 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));738}···745 * Returns true if the endpoint has isochronous transfer type and OUT direction,746 * otherwise it returns false.747 */748-static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd)0749{750 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));751}···777 * specific device.778 */779#define USB_DEVICE(vend,prod) \780- .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \781- .idProduct = (prod)0782/**783 * USB_DEVICE_VER - macro used to describe a specific usb device with a784 * version range···791 * This macro is used to create a struct usb_device_id that matches a792 * specific device, with a version range.793 */794-#define USB_DEVICE_VER(vend,prod,lo,hi) \795 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \796- .idVendor = (vend), .idProduct = (prod), \797- .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)00798799/**800 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb···808 * This macro is used to create a struct usb_device_id that matches a809 * specific interface protocol of devices.810 */811-#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \812- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \0813 .idVendor = (vend), \814 .idProduct = (prod), \815 .bInterfaceProtocol = (pr)···824 * This macro is used to create a struct usb_device_id that matches a825 * specific class of devices.826 */827-#define USB_DEVICE_INFO(cl,sc,pr) \828- .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \829- .bDeviceSubClass = (sc), .bDeviceProtocol = (pr)00830831/**832- * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 833 * @cl: bInterfaceClass value834 * @sc: bInterfaceSubClass value835 * @pr: bInterfaceProtocol value···839 * This macro is used to create a struct usb_device_id that matches a840 * specific class of interfaces.841 */842-#define USB_INTERFACE_INFO(cl,sc,pr) \843- .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \844- .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)00845846/**847 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device···860 * This is especially useful when explicitly matching devices that have861 * vendor specific bDeviceClass values, but standards-compliant interfaces.862 */863-#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \864 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \865 | USB_DEVICE_ID_MATCH_DEVICE, \866- .idVendor = (vend), .idProduct = (prod), \0867 .bInterfaceClass = (cl), \868- .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)0869870/* ----------------------------------------------------------------------- */871···1145 * transferred. It will normally be the same as requested, unless1146 * either an error was reported or a short read was performed.1147 * The URB_SHORT_NOT_OK transfer flag may be used to make such1148- * short reads be reported as errors. 1149 * @setup_packet: Only used for control transfers, this points to eight bytes1150 * of setup data. Control transfers always start by sending this data1151 * to the device. Then transfer_buffer is read or written, if needed.···1164 * @complete: Completion handler. This URB is passed as the parameter to the1165 * completion function. The completion function may then do what1166 * it likes with the URB, including resubmitting or freeing it.1167- * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 1168 * collect the transfer status for each buffer.1169 *1170 * This structure identifies USB transfer requests. URBs must be allocated by···1268 * when the urb is owned by the hcd, that is, since the call to1269 * usb_submit_urb() till the entry into the completion routine.1270 */1271-struct urb1272-{1273 /* private: usb core and host controller only fields in the urb */1274 struct kref kref; /* reference count of the URB */1275 void *hcpriv; /* private data for host controller */···1279 /* public: documented fields in the urb that can be used by drivers */1280 struct list_head urb_list; /* list head for use by the urb's1281 * current owner */1282- struct list_head anchor_list; /* the URB may be anchored by the driver */1283 struct usb_anchor *anchor;1284 struct usb_device *dev; /* (in) pointer to associated device */1285- struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */1286 unsigned int pipe; /* (in) pipe information */1287 int status; /* (return) non-ISO status */1288 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/···1319 * Initializes a control urb with the proper information needed to submit1320 * it to a device.1321 */1322-static inline void usb_fill_control_urb (struct urb *urb,1323- struct usb_device *dev,1324- unsigned int pipe,1325- unsigned char *setup_packet,1326- void *transfer_buffer,1327- int buffer_length,1328- usb_complete_t complete_fn,1329- void *context)1330{1331 urb->dev = dev;1332 urb->pipe = pipe;···1350 * Initializes a bulk urb with the proper information needed to submit it1351 * to a device.1352 */1353-static inline void usb_fill_bulk_urb (struct urb *urb,1354- struct usb_device *dev,1355- unsigned int pipe,1356- void *transfer_buffer,1357- int buffer_length,1358- usb_complete_t complete_fn,1359- void *context)1360{1361 urb->dev = dev;1362 urb->pipe = pipe;···1384 * the endpoint interval, and express polling intervals in microframes1385 * (eight per millisecond) rather than in frames (one per millisecond).1386 */1387-static inline void usb_fill_int_urb (struct urb *urb,1388- struct usb_device *dev,1389- unsigned int pipe,1390- void *transfer_buffer,1391- int buffer_length,1392- usb_complete_t complete_fn,1393- void *context,1394- int interval)1395{1396 urb->dev = dev;1397 urb->pipe = pipe;···1444 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;1445}14461447-void *usb_buffer_alloc (struct usb_device *dev, size_t size,1448 gfp_t mem_flags, dma_addr_t *dma);1449-void usb_buffer_free (struct usb_device *dev, size_t size,1450 void *addr, dma_addr_t dma);14511452#if 01453-struct urb *usb_buffer_map (struct urb *urb);1454-void usb_buffer_dmasync (struct urb *urb);1455-void usb_buffer_unmap (struct urb *urb);1456#endif14571458struct scatterlist;···1524 int status;1525 size_t bytes;15261527- /* 1528 * members below are private: to usbcore,1529 * and are not provided for driver access!1530 */···1542 struct completion complete;1543};15441545-int usb_sg_init (1546 struct usb_sg_request *io,1547 struct usb_device *dev,1548- unsigned pipe, 1549 unsigned period,1550 struct scatterlist *sg,1551 int nents,1552 size_t length,1553 gfp_t mem_flags1554);1555-void usb_sg_cancel (struct usb_sg_request *io);1556-void usb_sg_wait (struct usb_sg_request *io);155715581559/* ----------------------------------------------------------------------- */···16101611/* Create various pipes... */1612#define usb_sndctrlpipe(dev,endpoint) \1613- ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))1614#define usb_rcvctrlpipe(dev,endpoint) \1615- ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)1616#define usb_sndisocpipe(dev,endpoint) \1617- ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))1618#define usb_rcvisocpipe(dev,endpoint) \1619- ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)1620#define usb_sndbulkpipe(dev,endpoint) \1621- ((PIPE_BULK << 30) | __create_pipe(dev,endpoint))1622#define usb_rcvbulkpipe(dev,endpoint) \1623- ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)1624#define usb_sndintpipe(dev,endpoint) \1625- ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))1626#define usb_rcvintpipe(dev,endpoint) \1627- ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)16281629/*-------------------------------------------------------------------------*/1630
···162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */163164 struct device dev; /* interface specific device info */165+ struct device *usb_dev;166 int pm_usage_cnt; /* usage counter for autosuspend */167};168#define to_usb_interface(d) container_of(d, struct usb_interface, dev)169#define interface_to_usbdev(intf) \170 container_of(intf->dev.parent, struct usb_device, dev)171172+static inline void *usb_get_intfdata(struct usb_interface *intf)173{174+ return dev_get_drvdata(&intf->dev);175}176177+static inline void usb_set_intfdata(struct usb_interface *intf, void *data)178{179 dev_set_drvdata(&intf->dev, data);180}···275276int __usb_get_extra_descriptor(char *buffer, unsigned size,277 unsigned char type, void **ptr);278+#define usb_get_extra_descriptor(ifpoint, type, ptr) \279+ __usb_get_extra_descriptor((ifpoint)->extra, \280+ (ifpoint)->extralen, \281+ type, (void **)ptr)282283/* ----------------------------------------------------------------------- */284···388 unsigned can_submit:1; /* URBs may be submitted */389 unsigned discon_suspended:1; /* Disconnected while suspended */390 unsigned have_langid:1; /* whether string_langid is valid */391+ unsigned authorized:1; /* Policy has said we can use it */392 unsigned wusb:1; /* Device is Wireless USB */393 int string_langid; /* language ID for strings */394···417418 int pm_usage_cnt; /* usage counter for autosuspend */419 u32 quirks; /* quirks of the whole device */420+ atomic_t urbnum; /* number of URBs submitted for421+ the whole device */422423 unsigned long active_duration; /* total time device is not suspended */424···501/*-------------------------------------------------------------------------*/502503/* for drivers using iso endpoints */504+extern int usb_get_current_frame_number(struct usb_device *usb_dev);505506/* used these for multi-interface device registration */507extern int usb_driver_claim_interface(struct usb_driver *driver,508+ struct usb_interface *iface, void *priv);509510/**511 * usb_interface_claimed - returns true iff an interface is claimed···517 * may need to explicitly claim that lock.518 *519 */520+static inline int usb_interface_claimed(struct usb_interface *iface)521+{522 return (iface->dev.driver != NULL);523}524···560 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are561 * high speed, and a different one if they are full or low speed.562 */563+static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)0564{565 int actual;566+ actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name,567+ dev->devpath);568 return (actual >= (int)size) ? -1 : actual;569}570···611 *612 * Returns true if the endpoint is of type OUT, otherwise it returns false.613 */614+static inline int usb_endpoint_dir_out(615+ const struct usb_endpoint_descriptor *epd)616{617 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);618}···622 *623 * Returns true if the endpoint is of type bulk, otherwise it returns false.624 */625+static inline int usb_endpoint_xfer_bulk(626+ const struct usb_endpoint_descriptor *epd)627{628 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==629 USB_ENDPOINT_XFER_BULK);···634 *635 * Returns true if the endpoint is of type control, otherwise it returns false.636 */637+static inline int usb_endpoint_xfer_control(638+ const struct usb_endpoint_descriptor *epd)639{640 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==641 USB_ENDPOINT_XFER_CONTROL);···647 * Returns true if the endpoint is of type interrupt, otherwise it returns648 * false.649 */650+static inline int usb_endpoint_xfer_int(651+ const struct usb_endpoint_descriptor *epd)652{653 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==654 USB_ENDPOINT_XFER_INT);···660 * Returns true if the endpoint is of type isochronous, otherwise it returns661 * false.662 */663+static inline int usb_endpoint_xfer_isoc(664+ const struct usb_endpoint_descriptor *epd)665{666 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==667 USB_ENDPOINT_XFER_ISOC);···673 * Returns true if the endpoint has bulk transfer type and IN direction,674 * otherwise it returns false.675 */676+static inline int usb_endpoint_is_bulk_in(677+ const struct usb_endpoint_descriptor *epd)678{679 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));680}···685 * Returns true if the endpoint has bulk transfer type and OUT direction,686 * otherwise it returns false.687 */688+static inline int usb_endpoint_is_bulk_out(689+ const struct usb_endpoint_descriptor *epd)690{691 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));692}···697 * Returns true if the endpoint has interrupt transfer type and IN direction,698 * otherwise it returns false.699 */700+static inline int usb_endpoint_is_int_in(701+ const struct usb_endpoint_descriptor *epd)702{703 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));704}···709 * Returns true if the endpoint has interrupt transfer type and OUT direction,710 * otherwise it returns false.711 */712+static inline int usb_endpoint_is_int_out(713+ const struct usb_endpoint_descriptor *epd)714{715 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));716}···721 * Returns true if the endpoint has isochronous transfer type and IN direction,722 * otherwise it returns false.723 */724+static inline int usb_endpoint_is_isoc_in(725+ const struct usb_endpoint_descriptor *epd)726{727 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));728}···733 * Returns true if the endpoint has isochronous transfer type and OUT direction,734 * otherwise it returns false.735 */736+static inline int usb_endpoint_is_isoc_out(737+ const struct usb_endpoint_descriptor *epd)738{739 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));740}···764 * specific device.765 */766#define USB_DEVICE(vend,prod) \767+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \768+ .idVendor = (vend), \769+ .idProduct = (prod)770/**771 * USB_DEVICE_VER - macro used to describe a specific usb device with a772 * version range···777 * This macro is used to create a struct usb_device_id that matches a778 * specific device, with a version range.779 */780+#define USB_DEVICE_VER(vend, prod, lo, hi) \781 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \782+ .idVendor = (vend), \783+ .idProduct = (prod), \784+ .bcdDevice_lo = (lo), \785+ .bcdDevice_hi = (hi)786787/**788 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb···792 * This macro is used to create a struct usb_device_id that matches a793 * specific interface protocol of devices.794 */795+#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \796+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \797+ USB_DEVICE_ID_MATCH_INT_PROTOCOL, \798 .idVendor = (vend), \799 .idProduct = (prod), \800 .bInterfaceProtocol = (pr)···807 * This macro is used to create a struct usb_device_id that matches a808 * specific class of devices.809 */810+#define USB_DEVICE_INFO(cl, sc, pr) \811+ .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \812+ .bDeviceClass = (cl), \813+ .bDeviceSubClass = (sc), \814+ .bDeviceProtocol = (pr)815816/**817+ * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces818 * @cl: bInterfaceClass value819 * @sc: bInterfaceSubClass value820 * @pr: bInterfaceProtocol value···820 * This macro is used to create a struct usb_device_id that matches a821 * specific class of interfaces.822 */823+#define USB_INTERFACE_INFO(cl, sc, pr) \824+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \825+ .bInterfaceClass = (cl), \826+ .bInterfaceSubClass = (sc), \827+ .bInterfaceProtocol = (pr)828829/**830 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device···839 * This is especially useful when explicitly matching devices that have840 * vendor specific bDeviceClass values, but standards-compliant interfaces.841 */842+#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \843 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \844 | USB_DEVICE_ID_MATCH_DEVICE, \845+ .idVendor = (vend), \846+ .idProduct = (prod), \847 .bInterfaceClass = (cl), \848+ .bInterfaceSubClass = (sc), \849+ .bInterfaceProtocol = (pr)850851/* ----------------------------------------------------------------------- */852···1122 * transferred. It will normally be the same as requested, unless1123 * either an error was reported or a short read was performed.1124 * The URB_SHORT_NOT_OK transfer flag may be used to make such1125+ * short reads be reported as errors.1126 * @setup_packet: Only used for control transfers, this points to eight bytes1127 * of setup data. Control transfers always start by sending this data1128 * to the device. Then transfer_buffer is read or written, if needed.···1141 * @complete: Completion handler. This URB is passed as the parameter to the1142 * completion function. The completion function may then do what1143 * it likes with the URB, including resubmitting or freeing it.1144+ * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to1145 * collect the transfer status for each buffer.1146 *1147 * This structure identifies USB transfer requests. URBs must be allocated by···1245 * when the urb is owned by the hcd, that is, since the call to1246 * usb_submit_urb() till the entry into the completion routine.1247 */1248+struct urb {01249 /* private: usb core and host controller only fields in the urb */1250 struct kref kref; /* reference count of the URB */1251 void *hcpriv; /* private data for host controller */···1257 /* public: documented fields in the urb that can be used by drivers */1258 struct list_head urb_list; /* list head for use by the urb's1259 * current owner */1260+ struct list_head anchor_list; /* the URB may be anchored */1261 struct usb_anchor *anchor;1262 struct usb_device *dev; /* (in) pointer to associated device */1263+ struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */1264 unsigned int pipe; /* (in) pipe information */1265 int status; /* (return) non-ISO status */1266 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/···1297 * Initializes a control urb with the proper information needed to submit1298 * it to a device.1299 */1300+static inline void usb_fill_control_urb(struct urb *urb,1301+ struct usb_device *dev,1302+ unsigned int pipe,1303+ unsigned char *setup_packet,1304+ void *transfer_buffer,1305+ int buffer_length,1306+ usb_complete_t complete_fn,1307+ void *context)1308{1309 urb->dev = dev;1310 urb->pipe = pipe;···1328 * Initializes a bulk urb with the proper information needed to submit it1329 * to a device.1330 */1331+static inline void usb_fill_bulk_urb(struct urb *urb,1332+ struct usb_device *dev,1333+ unsigned int pipe,1334+ void *transfer_buffer,1335+ int buffer_length,1336+ usb_complete_t complete_fn,1337+ void *context)1338{1339 urb->dev = dev;1340 urb->pipe = pipe;···1362 * the endpoint interval, and express polling intervals in microframes1363 * (eight per millisecond) rather than in frames (one per millisecond).1364 */1365+static inline void usb_fill_int_urb(struct urb *urb,1366+ struct usb_device *dev,1367+ unsigned int pipe,1368+ void *transfer_buffer,1369+ int buffer_length,1370+ usb_complete_t complete_fn,1371+ void *context,1372+ int interval)1373{1374 urb->dev = dev;1375 urb->pipe = pipe;···1422 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;1423}14241425+void *usb_buffer_alloc(struct usb_device *dev, size_t size,1426 gfp_t mem_flags, dma_addr_t *dma);1427+void usb_buffer_free(struct usb_device *dev, size_t size,1428 void *addr, dma_addr_t dma);14291430#if 01431+struct urb *usb_buffer_map(struct urb *urb);1432+void usb_buffer_dmasync(struct urb *urb);1433+void usb_buffer_unmap(struct urb *urb);1434#endif14351436struct scatterlist;···1502 int status;1503 size_t bytes;15041505+ /*1506 * members below are private: to usbcore,1507 * and are not provided for driver access!1508 */···1520 struct completion complete;1521};15221523+int usb_sg_init(1524 struct usb_sg_request *io,1525 struct usb_device *dev,1526+ unsigned pipe,1527 unsigned period,1528 struct scatterlist *sg,1529 int nents,1530 size_t length,1531 gfp_t mem_flags1532);1533+void usb_sg_cancel(struct usb_sg_request *io);1534+void usb_sg_wait(struct usb_sg_request *io);153515361537/* ----------------------------------------------------------------------- */···15881589/* Create various pipes... */1590#define usb_sndctrlpipe(dev,endpoint) \1591+ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))1592#define usb_rcvctrlpipe(dev,endpoint) \1593+ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)1594#define usb_sndisocpipe(dev,endpoint) \1595+ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))1596#define usb_rcvisocpipe(dev,endpoint) \1597+ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)1598#define usb_sndbulkpipe(dev,endpoint) \1599+ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))1600#define usb_rcvbulkpipe(dev,endpoint) \1601+ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)1602#define usb_sndintpipe(dev,endpoint) \1603+ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))1604#define usb_rcvintpipe(dev,endpoint) \1605+ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)16061607/*-------------------------------------------------------------------------*/1608