diff options
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 818a1b4f737a..9d08f5a5ba76 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -1021,6 +1021,8 @@ extern int usb_disabled(void); | |||
1021 | 1021 | ||
1022 | /* | 1022 | /* |
1023 | * urb->transfer_flags: | 1023 | * urb->transfer_flags: |
1024 | * | ||
1025 | * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). | ||
1024 | */ | 1026 | */ |
1025 | #define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ | 1027 | #define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ |
1026 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame | 1028 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame |
@@ -1033,6 +1035,10 @@ extern int usb_disabled(void); | |||
1033 | * needed */ | 1035 | * needed */ |
1034 | #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ | 1036 | #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ |
1035 | 1037 | ||
1038 | #define URB_DIR_IN 0x0200 /* Transfer from device to host */ | ||
1039 | #define URB_DIR_OUT 0 | ||
1040 | #define URB_DIR_MASK URB_DIR_IN | ||
1041 | |||
1036 | struct usb_iso_packet_descriptor { | 1042 | struct usb_iso_packet_descriptor { |
1037 | unsigned int offset; | 1043 | unsigned int offset; |
1038 | unsigned int length; /* expected length */ | 1044 | unsigned int length; /* expected length */ |
@@ -1380,6 +1386,30 @@ extern void usb_unanchor_urb(struct urb *urb); | |||
1380 | extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, | 1386 | extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, |
1381 | unsigned int timeout); | 1387 | unsigned int timeout); |
1382 | 1388 | ||
1389 | /** | ||
1390 | * usb_urb_dir_in - check if an URB describes an IN transfer | ||
1391 | * @urb: URB to be checked | ||
1392 | * | ||
1393 | * Returns 1 if @urb describes an IN transfer (device-to-host), | ||
1394 | * otherwise 0. | ||
1395 | */ | ||
1396 | static inline int usb_urb_dir_in(struct urb *urb) | ||
1397 | { | ||
1398 | return (urb->transfer_flags & URB_DIR_MASK) != URB_DIR_OUT; | ||
1399 | } | ||
1400 | |||
1401 | /** | ||
1402 | * usb_urb_dir_out - check if an URB describes an OUT transfer | ||
1403 | * @urb: URB to be checked | ||
1404 | * | ||
1405 | * Returns 1 if @urb describes an OUT transfer (host-to-device), | ||
1406 | * otherwise 0. | ||
1407 | */ | ||
1408 | static inline int usb_urb_dir_out(struct urb *urb) | ||
1409 | { | ||
1410 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; | ||
1411 | } | ||
1412 | |||
1383 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 1413 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
1384 | gfp_t mem_flags, dma_addr_t *dma); | 1414 | gfp_t mem_flags, dma_addr_t *dma); |
1385 | void usb_buffer_free (struct usb_device *dev, size_t size, | 1415 | void usb_buffer_free (struct usb_device *dev, size_t size, |