aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-07-30 17:04:37 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:00 -0400
commit5b653c79c04c6b152b8dc7d18f8c8a7f77f4b235 (patch)
tree4ab74a90333751269f277789c3f45f7c06d07e14 /include/linux/usb.h
parenta96173af521a173f45d3a27fa24265081f12e978 (diff)
USB: add urb->ep
This patch (as943) prepares the way for eliminating urb->pipe by introducing an endpoint pointer into struct urb. For now urb->ep is set by usb_submit_urb() from the pipe value; eventually drivers will set it themselves and we will remove urb->pipe completely. The patch also adds new inline routines to retrieve an endpoint descriptor's number and transfer type, essentially as replacements for usb_pipeendpoint and usb_pipetype. usb_submit_urb(), usb_hcd_submit_urb(), and usb_hcd_unlink_urb() are converted to use the new field and new routines. Other parts of usbcore will be converted in later patches. 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.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 4f33a58fa9d1..105e3e9362d0 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -555,6 +555,29 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
555/*-------------------------------------------------------------------------*/ 555/*-------------------------------------------------------------------------*/
556 556
557/** 557/**
558 * usb_endpoint_num - get the endpoint's number
559 * @epd: endpoint to be checked
560 *
561 * Returns @epd's number: 0 to 15.
562 */
563static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
564{
565 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
566}
567
568/**
569 * usb_endpoint_type - get the endpoint's transfer type
570 * @epd: endpoint to be checked
571 *
572 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
573 * to @epd's transfer type.
574 */
575static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
576{
577 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
578}
579
580/**
558 * usb_endpoint_dir_in - check if the endpoint has IN direction 581 * usb_endpoint_dir_in - check if the endpoint has IN direction
559 * @epd: endpoint to be checked 582 * @epd: endpoint to be checked
560 * 583 *
@@ -1037,6 +1060,8 @@ typedef void (*usb_complete_t)(struct urb *);
1037 * @urb_list: For use by current owner of the URB. 1060 * @urb_list: For use by current owner of the URB.
1038 * @anchor_list: membership in the list of an anchor 1061 * @anchor_list: membership in the list of an anchor
1039 * @anchor: to anchor URBs to a common mooring 1062 * @anchor: to anchor URBs to a common mooring
1063 * @ep: Points to the endpoint's data structure. Will eventually
1064 * replace @pipe.
1040 * @pipe: Holds endpoint number, direction, type, and more. 1065 * @pipe: Holds endpoint number, direction, type, and more.
1041 * Create these values with the eight macros available; 1066 * Create these values with the eight macros available;
1042 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1067 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
@@ -1212,6 +1237,7 @@ struct urb
1212 struct list_head anchor_list; /* the URB may be anchored by the driver */ 1237 struct list_head anchor_list; /* the URB may be anchored by the driver */
1213 struct usb_anchor *anchor; 1238 struct usb_anchor *anchor;
1214 struct usb_device *dev; /* (in) pointer to associated device */ 1239 struct usb_device *dev; /* (in) pointer to associated device */
1240 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */
1215 unsigned int pipe; /* (in) pipe information */ 1241 unsigned int pipe; /* (in) pipe information */
1216 int status; /* (return) non-ISO status */ 1242 int status; /* (return) non-ISO status */
1217 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1243 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/