aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-04-17 10:18:11 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:54 -0400
commit14722ef4acedc643f0b78b7165ceff2d300dae4d (patch)
treeec7fba47784c4aebdcc898ab7c36e27773cbf185 /drivers/usb
parentaff6d18f95bb81b2d07994372c8edcc2c2b41180 (diff)
USB: usbfs: export the URB_NO_INTERRUPT flag to userspace
This patch (as1079) cleans up the way URB_* flags are exported in usbfs. The URB_NO_INTERRUPT flag is now exported (this is the only behavioral change). USBDEVFS_URB_* macros are added for URB_NO_FSBR, URB_ZERO_PACKET, and URB_NO_INTERRUPT, making explicit the fact that the kernel accepts them. The flag matching takes into account that the URB_* values may change as the kernel evolves, whereas the USBDEVFS_URB_* values must remain fixed since they are a user API. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devio.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 039ba23cc8b6..6c4cd82d7d14 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -948,8 +948,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
948 int ret, ifnum = -1; 948 int ret, ifnum = -1;
949 int is_in; 949 int is_in;
950 950
951 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| 951 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP |
952 URB_NO_FSBR|URB_ZERO_PACKET)) 952 USBDEVFS_URB_SHORT_NOT_OK |
953 USBDEVFS_URB_NO_FSBR |
954 USBDEVFS_URB_ZERO_PACKET |
955 USBDEVFS_URB_NO_INTERRUPT))
953 return -EINVAL; 956 return -EINVAL;
954 if (!uurb->buffer) 957 if (!uurb->buffer)
955 return -EINVAL; 958 return -EINVAL;
@@ -1104,8 +1107,24 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1104 as->urb->pipe = (uurb->type << 30) | 1107 as->urb->pipe = (uurb->type << 30) |
1105 __create_pipe(ps->dev, uurb->endpoint & 0xf) | 1108 __create_pipe(ps->dev, uurb->endpoint & 0xf) |
1106 (uurb->endpoint & USB_DIR_IN); 1109 (uurb->endpoint & USB_DIR_IN);
1107 as->urb->transfer_flags = uurb->flags | 1110
1108 (is_in ? URB_DIR_IN : URB_DIR_OUT); 1111 /* This tedious sequence is necessary because the URB_* flags
1112 * are internal to the kernel and subject to change, whereas
1113 * the USBDEVFS_URB_* flags are a user API and must not be changed.
1114 */
1115 u = (is_in ? URB_DIR_IN : URB_DIR_OUT);
1116 if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
1117 u |= URB_ISO_ASAP;
1118 if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
1119 u |= URB_SHORT_NOT_OK;
1120 if (uurb->flags & USBDEVFS_URB_NO_FSBR)
1121 u |= URB_NO_FSBR;
1122 if (uurb->flags & USBDEVFS_URB_ZERO_PACKET)
1123 u |= URB_ZERO_PACKET;
1124 if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT)
1125 u |= URB_NO_INTERRUPT;
1126 as->urb->transfer_flags = u;
1127
1109 as->urb->transfer_buffer_length = uurb->buffer_length; 1128 as->urb->transfer_buffer_length = uurb->buffer_length;
1110 as->urb->setup_packet = (unsigned char *)dr; 1129 as->urb->setup_packet = (unsigned char *)dr;
1111 as->urb->start_frame = uurb->start_frame; 1130 as->urb->start_frame = uurb->start_frame;