diff options
Diffstat (limited to 'include/linux/usb.h')
| -rw-r--r-- | include/linux/usb.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 0eec2689b955..001629cd1a97 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -337,6 +337,7 @@ struct usb_bus { | |||
| 337 | * the ep queue on a short transfer | 337 | * the ep queue on a short transfer |
| 338 | * with the URB_SHORT_NOT_OK flag set. | 338 | * with the URB_SHORT_NOT_OK flag set. |
| 339 | */ | 339 | */ |
| 340 | unsigned no_sg_constraint:1; /* no sg constraint */ | ||
| 340 | unsigned sg_tablesize; /* 0 or largest number of sg list entries */ | 341 | unsigned sg_tablesize; /* 0 or largest number of sg list entries */ |
| 341 | 342 | ||
| 342 | int devnum_next; /* Next open device number in | 343 | int devnum_next; /* Next open device number in |
| @@ -684,6 +685,11 @@ static inline bool usb_device_supports_ltm(struct usb_device *udev) | |||
| 684 | return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; | 685 | return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; |
| 685 | } | 686 | } |
| 686 | 687 | ||
| 688 | static inline bool usb_device_no_sg_constraint(struct usb_device *udev) | ||
| 689 | { | ||
| 690 | return udev && udev->bus && udev->bus->no_sg_constraint; | ||
| 691 | } | ||
| 692 | |||
| 687 | 693 | ||
| 688 | /*-------------------------------------------------------------------------*/ | 694 | /*-------------------------------------------------------------------------*/ |
| 689 | 695 | ||
| @@ -708,7 +714,10 @@ extern int usb_driver_claim_interface(struct usb_driver *driver, | |||
| 708 | * usb_interface_claimed - returns true iff an interface is claimed | 714 | * usb_interface_claimed - returns true iff an interface is claimed |
| 709 | * @iface: the interface being checked | 715 | * @iface: the interface being checked |
| 710 | * | 716 | * |
| 711 | * Returns true (nonzero) iff the interface is claimed, else false (zero). | 717 | * Return: %true (nonzero) iff the interface is claimed, else %false |
| 718 | * (zero). | ||
| 719 | * | ||
| 720 | * Note: | ||
| 712 | * Callers must own the driver model's usb bus readlock. So driver | 721 | * Callers must own the driver model's usb bus readlock. So driver |
| 713 | * probe() entries don't need extra locking, but other call contexts | 722 | * probe() entries don't need extra locking, but other call contexts |
| 714 | * may need to explicitly claim that lock. | 723 | * may need to explicitly claim that lock. |
| @@ -745,8 +754,9 @@ extern struct usb_host_interface *usb_find_alt_setting( | |||
| 745 | * @buf: where to put the string | 754 | * @buf: where to put the string |
| 746 | * @size: how big is "buf"? | 755 | * @size: how big is "buf"? |
| 747 | * | 756 | * |
| 748 | * Returns length of the string (> 0) or negative if size was too small. | 757 | * Return: Length of the string (> 0) or negative if size was too small. |
| 749 | * | 758 | * |
| 759 | * Note: | ||
| 750 | * This identifier is intended to be "stable", reflecting physical paths in | 760 | * This identifier is intended to be "stable", reflecting physical paths in |
| 751 | * hardware such as physical bus addresses for host controllers or ports on | 761 | * hardware such as physical bus addresses for host controllers or ports on |
| 752 | * USB hubs. That makes it stay the same until systems are physically | 762 | * USB hubs. That makes it stay the same until systems are physically |
| @@ -1247,7 +1257,9 @@ typedef void (*usb_complete_t)(struct urb *); | |||
| 1247 | * the device driver is saying that it provided this DMA address, | 1257 | * the device driver is saying that it provided this DMA address, |
| 1248 | * which the host controller driver should use in preference to the | 1258 | * which the host controller driver should use in preference to the |
| 1249 | * transfer_buffer. | 1259 | * transfer_buffer. |
| 1250 | * @sg: scatter gather buffer list | 1260 | * @sg: scatter gather buffer list, the buffer size of each element in |
| 1261 | * the list (except the last) must be divisible by the endpoint's | ||
| 1262 | * max packet size if no_sg_constraint isn't set in 'struct usb_bus' | ||
| 1251 | * @num_mapped_sgs: (internal) number of mapped sg entries | 1263 | * @num_mapped_sgs: (internal) number of mapped sg entries |
| 1252 | * @num_sgs: number of entries in the sg list | 1264 | * @num_sgs: number of entries in the sg list |
| 1253 | * @transfer_buffer_length: How big is transfer_buffer. The transfer may | 1265 | * @transfer_buffer_length: How big is transfer_buffer. The transfer may |
| @@ -1534,10 +1546,16 @@ static inline void usb_fill_int_urb(struct urb *urb, | |||
| 1534 | urb->transfer_buffer_length = buffer_length; | 1546 | urb->transfer_buffer_length = buffer_length; |
| 1535 | urb->complete = complete_fn; | 1547 | urb->complete = complete_fn; |
| 1536 | urb->context = context; | 1548 | urb->context = context; |
| 1537 | if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) | 1549 | |
| 1550 | if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) { | ||
| 1551 | /* make sure interval is within allowed range */ | ||
| 1552 | interval = clamp(interval, 1, 16); | ||
| 1553 | |||
| 1538 | urb->interval = 1 << (interval - 1); | 1554 | urb->interval = 1 << (interval - 1); |
| 1539 | else | 1555 | } else { |
| 1540 | urb->interval = interval; | 1556 | urb->interval = interval; |
| 1557 | } | ||
| 1558 | |||
| 1541 | urb->start_frame = -1; | 1559 | urb->start_frame = -1; |
| 1542 | } | 1560 | } |
| 1543 | 1561 | ||
| @@ -1570,7 +1588,7 @@ extern int usb_anchor_empty(struct usb_anchor *anchor); | |||
| 1570 | * usb_urb_dir_in - check if an URB describes an IN transfer | 1588 | * usb_urb_dir_in - check if an URB describes an IN transfer |
| 1571 | * @urb: URB to be checked | 1589 | * @urb: URB to be checked |
| 1572 | * | 1590 | * |
| 1573 | * Returns 1 if @urb describes an IN transfer (device-to-host), | 1591 | * Return: 1 if @urb describes an IN transfer (device-to-host), |
| 1574 | * otherwise 0. | 1592 | * otherwise 0. |
| 1575 | */ | 1593 | */ |
| 1576 | static inline int usb_urb_dir_in(struct urb *urb) | 1594 | static inline int usb_urb_dir_in(struct urb *urb) |
| @@ -1582,7 +1600,7 @@ static inline int usb_urb_dir_in(struct urb *urb) | |||
| 1582 | * usb_urb_dir_out - check if an URB describes an OUT transfer | 1600 | * usb_urb_dir_out - check if an URB describes an OUT transfer |
| 1583 | * @urb: URB to be checked | 1601 | * @urb: URB to be checked |
| 1584 | * | 1602 | * |
| 1585 | * Returns 1 if @urb describes an OUT transfer (host-to-device), | 1603 | * Return: 1 if @urb describes an OUT transfer (host-to-device), |
| 1586 | * otherwise 0. | 1604 | * otherwise 0. |
| 1587 | */ | 1605 | */ |
| 1588 | static inline int usb_urb_dir_out(struct urb *urb) | 1606 | static inline int usb_urb_dir_out(struct urb *urb) |
