aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 98e0338664fb..0873c6219efc 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1000,11 +1000,26 @@ struct usb_iso_packet_descriptor {
1000 1000
1001struct urb; 1001struct urb;
1002 1002
1003struct usb_anchor {
1004 struct list_head urb_list;
1005 wait_queue_head_t wait;
1006 spinlock_t lock;
1007};
1008
1009static inline void init_usb_anchor(struct usb_anchor *anchor)
1010{
1011 INIT_LIST_HEAD(&anchor->urb_list);
1012 init_waitqueue_head(&anchor->wait);
1013 spin_lock_init(&anchor->lock);
1014}
1015
1003typedef void (*usb_complete_t)(struct urb *); 1016typedef void (*usb_complete_t)(struct urb *);
1004 1017
1005/** 1018/**
1006 * struct urb - USB Request Block 1019 * struct urb - USB Request Block
1007 * @urb_list: For use by current owner of the URB. 1020 * @urb_list: For use by current owner of the URB.
1021 * @anchor_list: membership in the list of an anchor
1022 * @anchor: to anchor URBs to a common mooring
1008 * @pipe: Holds endpoint number, direction, type, and more. 1023 * @pipe: Holds endpoint number, direction, type, and more.
1009 * Create these values with the eight macros available; 1024 * Create these values with the eight macros available;
1010 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1025 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
@@ -1177,6 +1192,8 @@ struct urb
1177 /* public: documented fields in the urb that can be used by drivers */ 1192 /* public: documented fields in the urb that can be used by drivers */
1178 struct list_head urb_list; /* list head for use by the urb's 1193 struct list_head urb_list; /* list head for use by the urb's
1179 * current owner */ 1194 * current owner */
1195 struct list_head anchor_list; /* the URB may be anchored by the driver */
1196 struct usb_anchor *anchor;
1180 struct usb_device *dev; /* (in) pointer to associated device */ 1197 struct usb_device *dev; /* (in) pointer to associated device */
1181 unsigned int pipe; /* (in) pipe information */ 1198 unsigned int pipe; /* (in) pipe information */
1182 int status; /* (return) non-ISO status */ 1199 int status; /* (return) non-ISO status */
@@ -1312,6 +1329,11 @@ extern struct urb *usb_get_urb(struct urb *urb);
1312extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); 1329extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
1313extern int usb_unlink_urb(struct urb *urb); 1330extern int usb_unlink_urb(struct urb *urb);
1314extern void usb_kill_urb(struct urb *urb); 1331extern void usb_kill_urb(struct urb *urb);
1332extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1333extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1334extern void usb_unanchor_urb(struct urb *urb);
1335extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1336 unsigned int timeout);
1315 1337
1316void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1338void *usb_buffer_alloc (struct usb_device *dev, size_t size,
1317 gfp_t mem_flags, dma_addr_t *dma); 1339 gfp_t mem_flags, dma_addr_t *dma);