diff options
author | Yacine Belkadi <yacine.belkadi.1@gmail.com> | 2013-08-02 14:10:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-02 23:30:14 -0400 |
commit | 626f090c5cbbe557379978c7a9525011ad7fbbf6 (patch) | |
tree | a79ab527b8c1f21067d8d5126b029917bc0b838c | |
parent | 6b0a1cf732f917f2eaccb4a0dd6ae7bfc3ccda15 (diff) |
usb: fix some scripts/kernel-doc warnings
When building the htmldocs (in verbose mode), scripts/kernel-doc reports the
following type of warnings:
Warning(drivers/usb/core/usb.c:76): No description found for return value of
'usb_find_alt_setting'
Fix them by:
- adding some missing descriptions of return values
- using "Return" sections for those descriptions
Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/core/buffer.c | 5 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 22 | ||||
-rw-r--r-- | drivers/usb/core/file.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 37 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 37 | ||||
-rw-r--r-- | drivers/usb/core/message.c | 49 | ||||
-rw-r--r-- | drivers/usb/core/urb.c | 34 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 60 | ||||
-rw-r--r-- | include/linux/usb.h | 12 |
10 files changed, 173 insertions, 87 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index b0585e623ba9..23559746be92 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -43,10 +43,11 @@ static const size_t pool_max[HCD_BUFFER_POOLS] = { | |||
43 | * | 43 | * |
44 | * Call this as part of initializing a host controller that uses the dma | 44 | * Call this as part of initializing a host controller that uses the dma |
45 | * memory allocators. It initializes some pools of dma-coherent memory that | 45 | * memory allocators. It initializes some pools of dma-coherent memory that |
46 | * will be shared by all drivers using that controller, or returns a negative | 46 | * will be shared by all drivers using that controller. |
47 | * errno value on error. | ||
48 | * | 47 | * |
49 | * Call hcd_buffer_destroy() to clean up after using those pools. | 48 | * Call hcd_buffer_destroy() to clean up after using those pools. |
49 | * | ||
50 | * Return: 0 if successful. A negative errno value otherwise. | ||
50 | */ | 51 | */ |
51 | int hcd_buffer_create(struct usb_hcd *hcd) | 52 | int hcd_buffer_create(struct usb_hcd *hcd) |
52 | { | 53 | { |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 7609ac4aed1c..124bcc50b0b7 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -117,6 +117,8 @@ static DRIVER_ATTR(new_id, S_IRUGO | S_IWUSR, show_dynids, store_new_id); | |||
117 | * @count: input size | 117 | * @count: input size |
118 | * | 118 | * |
119 | * Removes a dynamic usb device ID from this driver. | 119 | * Removes a dynamic usb device ID from this driver. |
120 | * | ||
121 | * Return: @count on success. A negative error code otherwise. | ||
120 | */ | 122 | */ |
121 | static ssize_t | 123 | static ssize_t |
122 | store_remove_id(struct device_driver *driver, const char *buf, size_t count) | 124 | store_remove_id(struct device_driver *driver, const char *buf, size_t count) |
@@ -457,6 +459,8 @@ static int usb_unbind_interface(struct device *dev) | |||
457 | * Callers must own the device lock, so driver probe() entries don't need | 459 | * Callers must own the device lock, so driver probe() entries don't need |
458 | * extra locking, but other call contexts may need to explicitly claim that | 460 | * extra locking, but other call contexts may need to explicitly claim that |
459 | * lock. | 461 | * lock. |
462 | * | ||
463 | * Return: 0 on success. | ||
460 | */ | 464 | */ |
461 | int usb_driver_claim_interface(struct usb_driver *driver, | 465 | int usb_driver_claim_interface(struct usb_driver *driver, |
462 | struct usb_interface *iface, void *priv) | 466 | struct usb_interface *iface, void *priv) |
@@ -658,6 +662,8 @@ EXPORT_SYMBOL_GPL(usb_match_one_id); | |||
658 | * These device tables are exported with MODULE_DEVICE_TABLE, through | 662 | * These device tables are exported with MODULE_DEVICE_TABLE, through |
659 | * modutils, to support the driver loading functionality of USB hotplugging. | 663 | * modutils, to support the driver loading functionality of USB hotplugging. |
660 | * | 664 | * |
665 | * Return: The first matching usb_device_id, or %NULL. | ||
666 | * | ||
661 | * What Matches: | 667 | * What Matches: |
662 | * | 668 | * |
663 | * The "match_flags" element in a usb_device_id controls which | 669 | * The "match_flags" element in a usb_device_id controls which |
@@ -823,7 +829,8 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
823 | * Registers a USB device driver with the USB core. The list of | 829 | * Registers a USB device driver with the USB core. The list of |
824 | * unattached devices will be rescanned whenever a new driver is | 830 | * unattached devices will be rescanned whenever a new driver is |
825 | * added, allowing the new driver to attach to any recognized devices. | 831 | * added, allowing the new driver to attach to any recognized devices. |
826 | * Returns a negative error code on failure and 0 on success. | 832 | * |
833 | * Return: A negative error code on failure and 0 on success. | ||
827 | */ | 834 | */ |
828 | int usb_register_device_driver(struct usb_device_driver *new_udriver, | 835 | int usb_register_device_driver(struct usb_device_driver *new_udriver, |
829 | struct module *owner) | 836 | struct module *owner) |
@@ -879,7 +886,8 @@ EXPORT_SYMBOL_GPL(usb_deregister_device_driver); | |||
879 | * Registers a USB interface driver with the USB core. The list of | 886 | * Registers a USB interface driver with the USB core. The list of |
880 | * unattached interfaces will be rescanned whenever a new driver is | 887 | * unattached interfaces will be rescanned whenever a new driver is |
881 | * added, allowing the new driver to attach to any recognized interfaces. | 888 | * added, allowing the new driver to attach to any recognized interfaces. |
882 | * Returns a negative error code on failure and 0 on success. | 889 | * |
890 | * Return: A negative error code on failure and 0 on success. | ||
883 | * | 891 | * |
884 | * NOTE: if you want your driver to use the USB major number, you must call | 892 | * NOTE: if you want your driver to use the USB major number, you must call |
885 | * usb_register_dev() to enable that functionality. This function no longer | 893 | * usb_register_dev() to enable that functionality. This function no longer |
@@ -1213,6 +1221,8 @@ done: | |||
1213 | * unpredictable times. | 1221 | * unpredictable times. |
1214 | * | 1222 | * |
1215 | * This routine can run only in process context. | 1223 | * This routine can run only in process context. |
1224 | * | ||
1225 | * Return: 0 if the suspend succeeded. | ||
1216 | */ | 1226 | */ |
1217 | static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | 1227 | static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) |
1218 | { | 1228 | { |
@@ -1294,6 +1304,8 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1294 | * unpredictable times. | 1304 | * unpredictable times. |
1295 | * | 1305 | * |
1296 | * This routine can run only in process context. | 1306 | * This routine can run only in process context. |
1307 | * | ||
1308 | * Return: 0 on success. | ||
1297 | */ | 1309 | */ |
1298 | static int usb_resume_both(struct usb_device *udev, pm_message_t msg) | 1310 | static int usb_resume_both(struct usb_device *udev, pm_message_t msg) |
1299 | { | 1311 | { |
@@ -1491,6 +1503,8 @@ void usb_autosuspend_device(struct usb_device *udev) | |||
1491 | * The caller must hold @udev's device lock. | 1503 | * The caller must hold @udev's device lock. |
1492 | * | 1504 | * |
1493 | * This routine can run only in process context. | 1505 | * This routine can run only in process context. |
1506 | * | ||
1507 | * Return: 0 on success. A negative error code otherwise. | ||
1494 | */ | 1508 | */ |
1495 | int usb_autoresume_device(struct usb_device *udev) | 1509 | int usb_autoresume_device(struct usb_device *udev) |
1496 | { | 1510 | { |
@@ -1600,6 +1614,8 @@ EXPORT_SYMBOL_GPL(usb_autopm_put_interface_no_suspend); | |||
1600 | * However if the autoresume fails then the counter is re-decremented. | 1614 | * However if the autoresume fails then the counter is re-decremented. |
1601 | * | 1615 | * |
1602 | * This routine can run only in process context. | 1616 | * This routine can run only in process context. |
1617 | * | ||
1618 | * Return: 0 on success. | ||
1603 | */ | 1619 | */ |
1604 | int usb_autopm_get_interface(struct usb_interface *intf) | 1620 | int usb_autopm_get_interface(struct usb_interface *intf) |
1605 | { | 1621 | { |
@@ -1633,6 +1649,8 @@ EXPORT_SYMBOL_GPL(usb_autopm_get_interface); | |||
1633 | * resumed. | 1649 | * resumed. |
1634 | * | 1650 | * |
1635 | * This routine can run in atomic context. | 1651 | * This routine can run in atomic context. |
1652 | * | ||
1653 | * Return: 0 on success. A negative error code otherwise. | ||
1636 | */ | 1654 | */ |
1637 | int usb_autopm_get_interface_async(struct usb_interface *intf) | 1655 | int usb_autopm_get_interface_async(struct usb_interface *intf) |
1638 | { | 1656 | { |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 6a4c40766f0f..7421888087a3 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -153,7 +153,7 @@ void usb_major_cleanup(void) | |||
153 | * usb_deregister_dev() must be called when the driver is done with | 153 | * usb_deregister_dev() must be called when the driver is done with |
154 | * the minor numbers given out by this function. | 154 | * the minor numbers given out by this function. |
155 | * | 155 | * |
156 | * Returns -EINVAL if something bad happens with trying to register a | 156 | * Return: -EINVAL if something bad happens with trying to register a |
157 | * device, and 0 on success. | 157 | * device, and 0 on success. |
158 | */ | 158 | */ |
159 | int usb_register_dev(struct usb_interface *intf, | 159 | int usb_register_dev(struct usb_interface *intf, |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index caeb8d6d39fb..b9d3c43e3859 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -171,6 +171,8 @@ static void ehci_wait_for_companions(struct pci_dev *pdev, struct usb_hcd *hcd, | |||
171 | * through the hotplug entry's driver_data. | 171 | * through the hotplug entry's driver_data. |
172 | * | 172 | * |
173 | * Store this function in the HCD's struct pci_driver as probe(). | 173 | * Store this function in the HCD's struct pci_driver as probe(). |
174 | * | ||
175 | * Return: 0 if successful. | ||
174 | */ | 176 | */ |
175 | int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | 177 | int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
176 | { | 178 | { |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 014dc996b4f6..dc1346fee76c 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -378,9 +378,10 @@ MODULE_PARM_DESC(authorized_default, | |||
378 | * @buf: Buffer for USB string descriptor (header + UTF-16LE) | 378 | * @buf: Buffer for USB string descriptor (header + UTF-16LE) |
379 | * @len: Length (in bytes; may be odd) of descriptor buffer. | 379 | * @len: Length (in bytes; may be odd) of descriptor buffer. |
380 | * | 380 | * |
381 | * The return value is the number of bytes filled in: 2 + 2*strlen(s) or | 381 | * Return: The number of bytes filled in: 2 + 2*strlen(s) or @len, |
382 | * buflen, whichever is less. | 382 | * whichever is less. |
383 | * | 383 | * |
384 | * Note: | ||
384 | * USB String descriptors can contain at most 126 characters; input | 385 | * USB String descriptors can contain at most 126 characters; input |
385 | * strings longer than that are truncated. | 386 | * strings longer than that are truncated. |
386 | */ | 387 | */ |
@@ -416,7 +417,8 @@ ascii2desc(char const *s, u8 *buf, unsigned len) | |||
416 | * | 417 | * |
417 | * Produces either a manufacturer, product or serial number string for the | 418 | * Produces either a manufacturer, product or serial number string for the |
418 | * virtual root hub device. | 419 | * virtual root hub device. |
419 | * Returns the number of bytes filled in: the length of the descriptor or | 420 | * |
421 | * Return: The number of bytes filled in: the length of the descriptor or | ||
420 | * of the provided buffer, whichever is less. | 422 | * of the provided buffer, whichever is less. |
421 | */ | 423 | */ |
422 | static unsigned | 424 | static unsigned |
@@ -938,6 +940,8 @@ static void usb_bus_init (struct usb_bus *bus) | |||
938 | * | 940 | * |
939 | * Assigns a bus number, and links the controller into usbcore data | 941 | * Assigns a bus number, and links the controller into usbcore data |
940 | * structures so that it can be seen by scanning the bus list. | 942 | * structures so that it can be seen by scanning the bus list. |
943 | * | ||
944 | * Return: 0 if successful. A negative error code otherwise. | ||
941 | */ | 945 | */ |
942 | static int usb_register_bus(struct usb_bus *bus) | 946 | static int usb_register_bus(struct usb_bus *bus) |
943 | { | 947 | { |
@@ -1002,6 +1006,8 @@ static void usb_deregister_bus (struct usb_bus *bus) | |||
1002 | * the device properly in the device tree and then calls usb_new_device() | 1006 | * the device properly in the device tree and then calls usb_new_device() |
1003 | * to register the usb device. It also assigns the root hub's USB address | 1007 | * to register the usb device. It also assigns the root hub's USB address |
1004 | * (always 1). | 1008 | * (always 1). |
1009 | * | ||
1010 | * Return: 0 if successful. A negative error code otherwise. | ||
1005 | */ | 1011 | */ |
1006 | static int register_root_hub(struct usb_hcd *hcd) | 1012 | static int register_root_hub(struct usb_hcd *hcd) |
1007 | { | 1013 | { |
@@ -1108,7 +1114,9 @@ EXPORT_SYMBOL_GPL(usb_hcd_end_port_resume); | |||
1108 | * @isoc: true for isochronous transactions, false for interrupt ones | 1114 | * @isoc: true for isochronous transactions, false for interrupt ones |
1109 | * @bytecount: how many bytes in the transaction. | 1115 | * @bytecount: how many bytes in the transaction. |
1110 | * | 1116 | * |
1111 | * Returns approximate bus time in nanoseconds for a periodic transaction. | 1117 | * Return: Approximate bus time in nanoseconds for a periodic transaction. |
1118 | * | ||
1119 | * Note: | ||
1112 | * See USB 2.0 spec section 5.11.3; only periodic transfers need to be | 1120 | * See USB 2.0 spec section 5.11.3; only periodic transfers need to be |
1113 | * scheduled in software, this function is only used for such scheduling. | 1121 | * scheduled in software, this function is only used for such scheduling. |
1114 | */ | 1122 | */ |
@@ -1166,7 +1174,7 @@ EXPORT_SYMBOL_GPL(usb_calc_bus_time); | |||
1166 | * be disabled. The actions carried out here are required for URB | 1174 | * be disabled. The actions carried out here are required for URB |
1167 | * submission, as well as for endpoint shutdown and for usb_kill_urb. | 1175 | * submission, as well as for endpoint shutdown and for usb_kill_urb. |
1168 | * | 1176 | * |
1169 | * Returns 0 for no error, otherwise a negative error code (in which case | 1177 | * Return: 0 for no error, otherwise a negative error code (in which case |
1170 | * the enqueue() method must fail). If no error occurs but enqueue() fails | 1178 | * the enqueue() method must fail). If no error occurs but enqueue() fails |
1171 | * anyway, it must call usb_hcd_unlink_urb_from_ep() before releasing | 1179 | * anyway, it must call usb_hcd_unlink_urb_from_ep() before releasing |
1172 | * the private spinlock and returning. | 1180 | * the private spinlock and returning. |
@@ -1221,7 +1229,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_link_urb_to_ep); | |||
1221 | * be disabled. The actions carried out here are required for making | 1229 | * be disabled. The actions carried out here are required for making |
1222 | * sure than an unlink is valid. | 1230 | * sure than an unlink is valid. |
1223 | * | 1231 | * |
1224 | * Returns 0 for no error, otherwise a negative error code (in which case | 1232 | * Return: 0 for no error, otherwise a negative error code (in which case |
1225 | * the dequeue() method must fail). The possible error codes are: | 1233 | * the dequeue() method must fail). The possible error codes are: |
1226 | * | 1234 | * |
1227 | * -EIDRM: @urb was not submitted or has already completed. | 1235 | * -EIDRM: @urb was not submitted or has already completed. |
@@ -1784,7 +1792,7 @@ rescan: | |||
1784 | * pass in the current alternate interface setting in cur_alt, | 1792 | * pass in the current alternate interface setting in cur_alt, |
1785 | * and pass in the new alternate interface setting in new_alt. | 1793 | * and pass in the new alternate interface setting in new_alt. |
1786 | * | 1794 | * |
1787 | * Returns an error if the requested bandwidth change exceeds the | 1795 | * Return: An error if the requested bandwidth change exceeds the |
1788 | * bus bandwidth or host controller internal resources. | 1796 | * bus bandwidth or host controller internal resources. |
1789 | */ | 1797 | */ |
1790 | int usb_hcd_alloc_bandwidth(struct usb_device *udev, | 1798 | int usb_hcd_alloc_bandwidth(struct usb_device *udev, |
@@ -1954,9 +1962,12 @@ void usb_hcd_reset_endpoint(struct usb_device *udev, | |||
1954 | * @num_streams: number of streams to allocate. | 1962 | * @num_streams: number of streams to allocate. |
1955 | * @mem_flags: flags hcd should use to allocate memory. | 1963 | * @mem_flags: flags hcd should use to allocate memory. |
1956 | * | 1964 | * |
1957 | * Sets up a group of bulk endpoints to have num_streams stream IDs available. | 1965 | * Sets up a group of bulk endpoints to have @num_streams stream IDs available. |
1958 | * Drivers may queue multiple transfers to different stream IDs, which may | 1966 | * Drivers may queue multiple transfers to different stream IDs, which may |
1959 | * complete in a different order than they were queued. | 1967 | * complete in a different order than they were queued. |
1968 | * | ||
1969 | * Return: On success, the number of allocated streams. On failure, a negative | ||
1970 | * error code. | ||
1960 | */ | 1971 | */ |
1961 | int usb_alloc_streams(struct usb_interface *interface, | 1972 | int usb_alloc_streams(struct usb_interface *interface, |
1962 | struct usb_host_endpoint **eps, unsigned int num_eps, | 1973 | struct usb_host_endpoint **eps, unsigned int num_eps, |
@@ -2201,6 +2212,8 @@ EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); | |||
2201 | * khubd identifying and possibly configuring the device. | 2212 | * khubd identifying and possibly configuring the device. |
2202 | * This is needed by OTG controller drivers, where it helps meet | 2213 | * This is needed by OTG controller drivers, where it helps meet |
2203 | * HNP protocol timing requirements for starting a port reset. | 2214 | * HNP protocol timing requirements for starting a port reset. |
2215 | * | ||
2216 | * Return: 0 if successful. | ||
2204 | */ | 2217 | */ |
2205 | int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num) | 2218 | int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num) |
2206 | { | 2219 | { |
@@ -2235,6 +2248,8 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum); | |||
2235 | * | 2248 | * |
2236 | * If the controller isn't HALTed, calls the driver's irq handler. | 2249 | * If the controller isn't HALTed, calls the driver's irq handler. |
2237 | * Checks whether the controller is now dead. | 2250 | * Checks whether the controller is now dead. |
2251 | * | ||
2252 | * Return: %IRQ_HANDLED if the IRQ was handled. %IRQ_NONE otherwise. | ||
2238 | */ | 2253 | */ |
2239 | irqreturn_t usb_hcd_irq (int irq, void *__hcd) | 2254 | irqreturn_t usb_hcd_irq (int irq, void *__hcd) |
2240 | { | 2255 | { |
@@ -2320,7 +2335,8 @@ EXPORT_SYMBOL_GPL (usb_hc_died); | |||
2320 | * HC driver's private data. Initialize the generic members of the | 2335 | * HC driver's private data. Initialize the generic members of the |
2321 | * hcd structure. | 2336 | * hcd structure. |
2322 | * | 2337 | * |
2323 | * If memory is unavailable, returns NULL. | 2338 | * Return: On success, a pointer to the created and initialized HCD structure. |
2339 | * On failure (e.g. if memory is unavailable), %NULL. | ||
2324 | */ | 2340 | */ |
2325 | struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, | 2341 | struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, |
2326 | struct device *dev, const char *bus_name, | 2342 | struct device *dev, const char *bus_name, |
@@ -2384,7 +2400,8 @@ EXPORT_SYMBOL_GPL(usb_create_shared_hcd); | |||
2384 | * HC driver's private data. Initialize the generic members of the | 2400 | * HC driver's private data. Initialize the generic members of the |
2385 | * hcd structure. | 2401 | * hcd structure. |
2386 | * | 2402 | * |
2387 | * If memory is unavailable, returns NULL. | 2403 | * Return: On success, a pointer to the created and initialized HCD |
2404 | * structure. On failure (e.g. if memory is unavailable), %NULL. | ||
2388 | */ | 2405 | */ |
2389 | struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, | 2406 | struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, |
2390 | struct device *dev, const char *bus_name) | 2407 | struct device *dev, const char *bus_name) |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0416f835cfee..5d6d28a76e0a 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -734,6 +734,8 @@ static void hub_tt_work(struct work_struct *work) | |||
734 | * | 734 | * |
735 | * call this function to control port's power via setting or | 735 | * call this function to control port's power via setting or |
736 | * clearing the port's PORT_POWER feature. | 736 | * clearing the port's PORT_POWER feature. |
737 | * | ||
738 | * Return: 0 if successful. A negative error code otherwise. | ||
737 | */ | 739 | */ |
738 | int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, | 740 | int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, |
739 | int port1, bool set) | 741 | int port1, bool set) |
@@ -762,6 +764,8 @@ int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, | |||
762 | * | 764 | * |
763 | * It may not be possible for that hub to handle additional full (or low) | 765 | * It may not be possible for that hub to handle additional full (or low) |
764 | * speed transactions until that state is fully cleared out. | 766 | * speed transactions until that state is fully cleared out. |
767 | * | ||
768 | * Return: 0 if successful. A negative error code otherwise. | ||
765 | */ | 769 | */ |
766 | int usb_hub_clear_tt_buffer(struct urb *urb) | 770 | int usb_hub_clear_tt_buffer(struct urb *urb) |
767 | { | 771 | { |
@@ -964,6 +968,8 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1) | |||
964 | * see that the device has been disconnected. When the device is | 968 | * see that the device has been disconnected. When the device is |
965 | * physically unplugged and something is plugged in, the events will | 969 | * physically unplugged and something is plugged in, the events will |
966 | * be received and processed normally. | 970 | * be received and processed normally. |
971 | * | ||
972 | * Return: 0 if successful. A negative error code otherwise. | ||
967 | */ | 973 | */ |
968 | int usb_remove_device(struct usb_device *udev) | 974 | int usb_remove_device(struct usb_device *udev) |
969 | { | 975 | { |
@@ -2115,6 +2121,8 @@ static inline void announce_device(struct usb_device *udev) { } | |||
2115 | * @udev: newly addressed device (in ADDRESS state) | 2121 | * @udev: newly addressed device (in ADDRESS state) |
2116 | * | 2122 | * |
2117 | * Finish enumeration for On-The-Go devices | 2123 | * Finish enumeration for On-The-Go devices |
2124 | * | ||
2125 | * Return: 0 if successful. A negative error code otherwise. | ||
2118 | */ | 2126 | */ |
2119 | static int usb_enumerate_device_otg(struct usb_device *udev) | 2127 | static int usb_enumerate_device_otg(struct usb_device *udev) |
2120 | { | 2128 | { |
@@ -2197,6 +2205,8 @@ fail: | |||
2197 | * If the device is WUSB and not authorized, we don't attempt to read | 2205 | * If the device is WUSB and not authorized, we don't attempt to read |
2198 | * the string descriptors, as they will be errored out by the device | 2206 | * the string descriptors, as they will be errored out by the device |
2199 | * until it has been authorized. | 2207 | * until it has been authorized. |
2208 | * | ||
2209 | * Return: 0 if successful. A negative error code otherwise. | ||
2200 | */ | 2210 | */ |
2201 | static int usb_enumerate_device(struct usb_device *udev) | 2211 | static int usb_enumerate_device(struct usb_device *udev) |
2202 | { | 2212 | { |
@@ -2277,13 +2287,14 @@ static void set_usb_port_removable(struct usb_device *udev) | |||
2277 | * udev has already been installed, but udev is not yet visible through | 2287 | * udev has already been installed, but udev is not yet visible through |
2278 | * sysfs or other filesystem code. | 2288 | * sysfs or other filesystem code. |
2279 | * | 2289 | * |
2280 | * It will return if the device is configured properly or not. Zero if | ||
2281 | * the interface was registered with the driver core; else a negative | ||
2282 | * errno value. | ||
2283 | * | ||
2284 | * This call is synchronous, and may not be used in an interrupt context. | 2290 | * This call is synchronous, and may not be used in an interrupt context. |
2285 | * | 2291 | * |
2286 | * Only the hub driver or root-hub registrar should ever call this. | 2292 | * Only the hub driver or root-hub registrar should ever call this. |
2293 | * | ||
2294 | * Return: Whether the device is configured properly or not. Zero if the | ||
2295 | * interface was registered with the driver core; else a negative errno | ||
2296 | * value. | ||
2297 | * | ||
2287 | */ | 2298 | */ |
2288 | int usb_new_device(struct usb_device *udev) | 2299 | int usb_new_device(struct usb_device *udev) |
2289 | { | 2300 | { |
@@ -2391,6 +2402,8 @@ fail: | |||
2391 | * | 2402 | * |
2392 | * We share a lock (that we have) with device_del(), so we need to | 2403 | * We share a lock (that we have) with device_del(), so we need to |
2393 | * defer its call. | 2404 | * defer its call. |
2405 | * | ||
2406 | * Return: 0. | ||
2394 | */ | 2407 | */ |
2395 | int usb_deauthorize_device(struct usb_device *usb_dev) | 2408 | int usb_deauthorize_device(struct usb_device *usb_dev) |
2396 | { | 2409 | { |
@@ -5025,10 +5038,11 @@ static int descriptors_changed(struct usb_device *udev, | |||
5025 | * re-connected. All drivers will be unbound, and the device will be | 5038 | * re-connected. All drivers will be unbound, and the device will be |
5026 | * re-enumerated and probed all over again. | 5039 | * re-enumerated and probed all over again. |
5027 | * | 5040 | * |
5028 | * Returns 0 if the reset succeeded, -ENODEV if the device has been | 5041 | * Return: 0 if the reset succeeded, -ENODEV if the device has been |
5029 | * flagged for logical disconnection, or some other negative error code | 5042 | * flagged for logical disconnection, or some other negative error code |
5030 | * if the reset wasn't even attempted. | 5043 | * if the reset wasn't even attempted. |
5031 | * | 5044 | * |
5045 | * Note: | ||
5032 | * The caller must own the device lock. For example, it's safe to use | 5046 | * The caller must own the device lock. For example, it's safe to use |
5033 | * this from a driver probe() routine after downloading new firmware. | 5047 | * this from a driver probe() routine after downloading new firmware. |
5034 | * For calls that might not occur during probe(), drivers should lock | 5048 | * For calls that might not occur during probe(), drivers should lock |
@@ -5184,8 +5198,9 @@ re_enumerate: | |||
5184 | * method), performs the port reset, and then lets the drivers know that | 5198 | * method), performs the port reset, and then lets the drivers know that |
5185 | * the reset is over (using their post_reset method). | 5199 | * the reset is over (using their post_reset method). |
5186 | * | 5200 | * |
5187 | * Return value is the same as for usb_reset_and_verify_device(). | 5201 | * Return: The same as for usb_reset_and_verify_device(). |
5188 | * | 5202 | * |
5203 | * Note: | ||
5189 | * The caller must own the device lock. For example, it's safe to use | 5204 | * The caller must own the device lock. For example, it's safe to use |
5190 | * this from a driver probe() routine after downloading new firmware. | 5205 | * this from a driver probe() routine after downloading new firmware. |
5191 | * For calls that might not occur during probe(), drivers should lock | 5206 | * For calls that might not occur during probe(), drivers should lock |
@@ -5323,7 +5338,7 @@ EXPORT_SYMBOL_GPL(usb_queue_reset_device); | |||
5323 | * USB drivers call this function to get hub's child device | 5338 | * USB drivers call this function to get hub's child device |
5324 | * pointer. | 5339 | * pointer. |
5325 | * | 5340 | * |
5326 | * Return NULL if input param is invalid and | 5341 | * Return: %NULL if input param is invalid and |
5327 | * child's usb_device pointer if non-NULL. | 5342 | * child's usb_device pointer if non-NULL. |
5328 | */ | 5343 | */ |
5329 | struct usb_device *usb_hub_find_child(struct usb_device *hdev, | 5344 | struct usb_device *usb_hub_find_child(struct usb_device *hdev, |
@@ -5357,8 +5372,8 @@ void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1, | |||
5357 | * @hdev: USB device belonging to the usb hub | 5372 | * @hdev: USB device belonging to the usb hub |
5358 | * @port1: port num of the port | 5373 | * @port1: port num of the port |
5359 | * | 5374 | * |
5360 | * Return connect type of the port and if input params are | 5375 | * Return: The connect type of the port if successful. Or |
5361 | * invalid, return USB_PORT_CONNECT_TYPE_UNKNOWN. | 5376 | * USB_PORT_CONNECT_TYPE_UNKNOWN if input params are invalid. |
5362 | */ | 5377 | */ |
5363 | enum usb_port_connect_type | 5378 | enum usb_port_connect_type |
5364 | usb_get_hub_port_connect_type(struct usb_device *hdev, int port1) | 5379 | usb_get_hub_port_connect_type(struct usb_device *hdev, int port1) |
@@ -5418,8 +5433,8 @@ void usb_hub_adjust_deviceremovable(struct usb_device *hdev, | |||
5418 | * @hdev: USB device belonging to the usb hub | 5433 | * @hdev: USB device belonging to the usb hub |
5419 | * @port1: port num of the port | 5434 | * @port1: port num of the port |
5420 | * | 5435 | * |
5421 | * Return port's acpi handle if successful, NULL if params are | 5436 | * Return: Port's acpi handle if successful, %NULL if params are |
5422 | * invaild. | 5437 | * invalid. |
5423 | */ | 5438 | */ |
5424 | acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, | 5439 | acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, |
5425 | int port1) | 5440 | int port1) |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 6549a975b0c5..82927e1ed27d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -119,15 +119,15 @@ static int usb_internal_control_msg(struct usb_device *usb_dev, | |||
119 | * This function sends a simple control message to a specified endpoint and | 119 | * This function sends a simple control message to a specified endpoint and |
120 | * waits for the message to complete, or timeout. | 120 | * waits for the message to complete, or timeout. |
121 | * | 121 | * |
122 | * If successful, it returns the number of bytes transferred, otherwise a | ||
123 | * negative error number. | ||
124 | * | ||
125 | * Don't use this function from within an interrupt context, like a bottom half | 122 | * Don't use this function from within an interrupt context, like a bottom half |
126 | * handler. If you need an asynchronous message, or need to send a message | 123 | * handler. If you need an asynchronous message, or need to send a message |
127 | * from within interrupt context, use usb_submit_urb(). | 124 | * from within interrupt context, use usb_submit_urb(). |
128 | * If a thread in your driver uses this call, make sure your disconnect() | 125 | * If a thread in your driver uses this call, make sure your disconnect() |
129 | * method can wait for it to complete. Since you don't have a handle on the | 126 | * method can wait for it to complete. Since you don't have a handle on the |
130 | * URB used, you can't cancel the request. | 127 | * URB used, you can't cancel the request. |
128 | * | ||
129 | * Return: If successful, the number of bytes transferred. Otherwise, a negative | ||
130 | * error number. | ||
131 | */ | 131 | */ |
132 | int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, | 132 | int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, |
133 | __u8 requesttype, __u16 value, __u16 index, void *data, | 133 | __u8 requesttype, __u16 value, __u16 index, void *data, |
@@ -170,15 +170,16 @@ EXPORT_SYMBOL_GPL(usb_control_msg); | |||
170 | * This function sends a simple interrupt message to a specified endpoint and | 170 | * This function sends a simple interrupt message to a specified endpoint and |
171 | * waits for the message to complete, or timeout. | 171 | * waits for the message to complete, or timeout. |
172 | * | 172 | * |
173 | * If successful, it returns 0, otherwise a negative error number. The number | ||
174 | * of actual bytes transferred will be stored in the actual_length paramater. | ||
175 | * | ||
176 | * Don't use this function from within an interrupt context, like a bottom half | 173 | * Don't use this function from within an interrupt context, like a bottom half |
177 | * handler. If you need an asynchronous message, or need to send a message | 174 | * handler. If you need an asynchronous message, or need to send a message |
178 | * from within interrupt context, use usb_submit_urb() If a thread in your | 175 | * from within interrupt context, use usb_submit_urb() If a thread in your |
179 | * driver uses this call, make sure your disconnect() method can wait for it to | 176 | * driver uses this call, make sure your disconnect() method can wait for it to |
180 | * complete. Since you don't have a handle on the URB used, you can't cancel | 177 | * complete. Since you don't have a handle on the URB used, you can't cancel |
181 | * the request. | 178 | * the request. |
179 | * | ||
180 | * Return: | ||
181 | * If successful, 0. Otherwise a negative error number. The number of actual | ||
182 | * bytes transferred will be stored in the @actual_length paramater. | ||
182 | */ | 183 | */ |
183 | int usb_interrupt_msg(struct usb_device *usb_dev, unsigned int pipe, | 184 | int usb_interrupt_msg(struct usb_device *usb_dev, unsigned int pipe, |
184 | void *data, int len, int *actual_length, int timeout) | 185 | void *data, int len, int *actual_length, int timeout) |
@@ -203,9 +204,6 @@ EXPORT_SYMBOL_GPL(usb_interrupt_msg); | |||
203 | * This function sends a simple bulk message to a specified endpoint | 204 | * This function sends a simple bulk message to a specified endpoint |
204 | * and waits for the message to complete, or timeout. | 205 | * and waits for the message to complete, or timeout. |
205 | * | 206 | * |
206 | * If successful, it returns 0, otherwise a negative error number. The number | ||
207 | * of actual bytes transferred will be stored in the actual_length paramater. | ||
208 | * | ||
209 | * Don't use this function from within an interrupt context, like a bottom half | 207 | * Don't use this function from within an interrupt context, like a bottom half |
210 | * handler. If you need an asynchronous message, or need to send a message | 208 | * handler. If you need an asynchronous message, or need to send a message |
211 | * from within interrupt context, use usb_submit_urb() If a thread in your | 209 | * from within interrupt context, use usb_submit_urb() If a thread in your |
@@ -217,6 +215,11 @@ EXPORT_SYMBOL_GPL(usb_interrupt_msg); | |||
217 | * users are forced to abuse this routine by using it to submit URBs for | 215 | * users are forced to abuse this routine by using it to submit URBs for |
218 | * interrupt endpoints. We will take the liberty of creating an interrupt URB | 216 | * interrupt endpoints. We will take the liberty of creating an interrupt URB |
219 | * (with the default interval) if the target is an interrupt endpoint. | 217 | * (with the default interval) if the target is an interrupt endpoint. |
218 | * | ||
219 | * Return: | ||
220 | * If successful, 0. Otherwise a negative error number. The number of actual | ||
221 | * bytes transferred will be stored in the @actual_length paramater. | ||
222 | * | ||
220 | */ | 223 | */ |
221 | int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, | 224 | int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, |
222 | void *data, int len, int *actual_length, int timeout) | 225 | void *data, int len, int *actual_length, int timeout) |
@@ -341,9 +344,9 @@ static void sg_complete(struct urb *urb) | |||
341 | * send every byte identified in the list. | 344 | * send every byte identified in the list. |
342 | * @mem_flags: SLAB_* flags affecting memory allocations in this call | 345 | * @mem_flags: SLAB_* flags affecting memory allocations in this call |
343 | * | 346 | * |
344 | * Returns zero for success, else a negative errno value. This initializes a | 347 | * This initializes a scatter/gather request, allocating resources such as |
345 | * scatter/gather request, allocating resources such as I/O mappings and urb | 348 | * I/O mappings and urb memory (except maybe memory used by USB controller |
346 | * memory (except maybe memory used by USB controller drivers). | 349 | * drivers). |
347 | * | 350 | * |
348 | * The request must be issued using usb_sg_wait(), which waits for the I/O to | 351 | * The request must be issued using usb_sg_wait(), which waits for the I/O to |
349 | * complete (or to be canceled) and then cleans up all resources allocated by | 352 | * complete (or to be canceled) and then cleans up all resources allocated by |
@@ -351,6 +354,8 @@ static void sg_complete(struct urb *urb) | |||
351 | * | 354 | * |
352 | * The request may be canceled with usb_sg_cancel(), either before or after | 355 | * The request may be canceled with usb_sg_cancel(), either before or after |
353 | * usb_sg_wait() is called. | 356 | * usb_sg_wait() is called. |
357 | * | ||
358 | * Return: Zero for success, else a negative errno value. | ||
354 | */ | 359 | */ |
355 | int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, | 360 | int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, |
356 | unsigned pipe, unsigned period, struct scatterlist *sg, | 361 | unsigned pipe, unsigned period, struct scatterlist *sg, |
@@ -623,7 +628,7 @@ EXPORT_SYMBOL_GPL(usb_sg_cancel); | |||
623 | * | 628 | * |
624 | * This call is synchronous, and may not be used in an interrupt context. | 629 | * This call is synchronous, and may not be used in an interrupt context. |
625 | * | 630 | * |
626 | * Returns the number of bytes received on success, or else the status code | 631 | * Return: The number of bytes received on success, or else the status code |
627 | * returned by the underlying usb_control_msg() call. | 632 | * returned by the underlying usb_control_msg() call. |
628 | */ | 633 | */ |
629 | int usb_get_descriptor(struct usb_device *dev, unsigned char type, | 634 | int usb_get_descriptor(struct usb_device *dev, unsigned char type, |
@@ -671,7 +676,7 @@ EXPORT_SYMBOL_GPL(usb_get_descriptor); | |||
671 | * | 676 | * |
672 | * This call is synchronous, and may not be used in an interrupt context. | 677 | * This call is synchronous, and may not be used in an interrupt context. |
673 | * | 678 | * |
674 | * Returns the number of bytes received on success, or else the status code | 679 | * Return: The number of bytes received on success, or else the status code |
675 | * returned by the underlying usb_control_msg() call. | 680 | * returned by the underlying usb_control_msg() call. |
676 | */ | 681 | */ |
677 | static int usb_get_string(struct usb_device *dev, unsigned short langid, | 682 | static int usb_get_string(struct usb_device *dev, unsigned short langid, |
@@ -805,7 +810,7 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) | |||
805 | * | 810 | * |
806 | * This call is synchronous, and may not be used in an interrupt context. | 811 | * This call is synchronous, and may not be used in an interrupt context. |
807 | * | 812 | * |
808 | * Returns length of the string (>= 0) or usb_control_msg status (< 0). | 813 | * Return: length of the string (>= 0) or usb_control_msg status (< 0). |
809 | */ | 814 | */ |
810 | int usb_string(struct usb_device *dev, int index, char *buf, size_t size) | 815 | int usb_string(struct usb_device *dev, int index, char *buf, size_t size) |
811 | { | 816 | { |
@@ -853,8 +858,8 @@ EXPORT_SYMBOL_GPL(usb_string); | |||
853 | * @udev: the device whose string descriptor is being read | 858 | * @udev: the device whose string descriptor is being read |
854 | * @index: the descriptor index | 859 | * @index: the descriptor index |
855 | * | 860 | * |
856 | * Returns a pointer to a kmalloc'ed buffer containing the descriptor string, | 861 | * Return: A pointer to a kmalloc'ed buffer containing the descriptor string, |
857 | * or NULL if the index is 0 or the string could not be read. | 862 | * or %NULL if the index is 0 or the string could not be read. |
858 | */ | 863 | */ |
859 | char *usb_cache_string(struct usb_device *udev, int index) | 864 | char *usb_cache_string(struct usb_device *udev, int index) |
860 | { | 865 | { |
@@ -894,7 +899,7 @@ char *usb_cache_string(struct usb_device *udev, int index) | |||
894 | * | 899 | * |
895 | * This call is synchronous, and may not be used in an interrupt context. | 900 | * This call is synchronous, and may not be used in an interrupt context. |
896 | * | 901 | * |
897 | * Returns the number of bytes received on success, or else the status code | 902 | * Return: The number of bytes received on success, or else the status code |
898 | * returned by the underlying usb_control_msg() call. | 903 | * returned by the underlying usb_control_msg() call. |
899 | */ | 904 | */ |
900 | int usb_get_device_descriptor(struct usb_device *dev, unsigned int size) | 905 | int usb_get_device_descriptor(struct usb_device *dev, unsigned int size) |
@@ -980,7 +985,7 @@ EXPORT_SYMBOL_GPL(usb_get_status); | |||
980 | * | 985 | * |
981 | * This call is synchronous, and may not be used in an interrupt context. | 986 | * This call is synchronous, and may not be used in an interrupt context. |
982 | * | 987 | * |
983 | * Returns zero on success, or else the status code returned by the | 988 | * Return: Zero on success, or else the status code returned by the |
984 | * underlying usb_control_msg() call. | 989 | * underlying usb_control_msg() call. |
985 | */ | 990 | */ |
986 | int usb_clear_halt(struct usb_device *dev, int pipe) | 991 | int usb_clear_halt(struct usb_device *dev, int pipe) |
@@ -1277,7 +1282,7 @@ void usb_enable_interface(struct usb_device *dev, | |||
1277 | * endpoints in that interface; all such urbs must first be completed | 1282 | * endpoints in that interface; all such urbs must first be completed |
1278 | * (perhaps forced by unlinking). | 1283 | * (perhaps forced by unlinking). |
1279 | * | 1284 | * |
1280 | * Returns zero on success, or else the status code returned by the | 1285 | * Return: Zero on success, or else the status code returned by the |
1281 | * underlying usb_control_msg() call. | 1286 | * underlying usb_control_msg() call. |
1282 | */ | 1287 | */ |
1283 | int usb_set_interface(struct usb_device *dev, int interface, int alternate) | 1288 | int usb_set_interface(struct usb_device *dev, int interface, int alternate) |
@@ -1431,7 +1436,7 @@ EXPORT_SYMBOL_GPL(usb_set_interface); | |||
1431 | * | 1436 | * |
1432 | * The caller must own the device lock. | 1437 | * The caller must own the device lock. |
1433 | * | 1438 | * |
1434 | * Returns zero on success, else a negative error code. | 1439 | * Return: Zero on success, else a negative error code. |
1435 | */ | 1440 | */ |
1436 | int usb_reset_configuration(struct usb_device *dev) | 1441 | int usb_reset_configuration(struct usb_device *dev) |
1437 | { | 1442 | { |
@@ -1973,7 +1978,7 @@ static void cancel_async_set_config(struct usb_device *udev) | |||
1973 | * routine gets around the normal restrictions by using a work thread to | 1978 | * routine gets around the normal restrictions by using a work thread to |
1974 | * submit the change-config request. | 1979 | * submit the change-config request. |
1975 | * | 1980 | * |
1976 | * Returns 0 if the request was successfully queued, error code otherwise. | 1981 | * Return: 0 if the request was successfully queued, error code otherwise. |
1977 | * The caller has no way to know whether the queued request will eventually | 1982 | * The caller has no way to know whether the queued request will eventually |
1978 | * succeed. | 1983 | * succeed. |
1979 | */ | 1984 | */ |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index e75115a04a2e..4e7a311ff6d7 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -55,12 +55,12 @@ EXPORT_SYMBOL_GPL(usb_init_urb); | |||
55 | * Creates an urb for the USB driver to use, initializes a few internal | 55 | * Creates an urb for the USB driver to use, initializes a few internal |
56 | * structures, incrementes the usage counter, and returns a pointer to it. | 56 | * structures, incrementes the usage counter, and returns a pointer to it. |
57 | * | 57 | * |
58 | * If no memory is available, NULL is returned. | ||
59 | * | ||
60 | * If the driver want to use this urb for interrupt, control, or bulk | 58 | * If the driver want to use this urb for interrupt, control, or bulk |
61 | * endpoints, pass '0' as the number of iso packets. | 59 | * endpoints, pass '0' as the number of iso packets. |
62 | * | 60 | * |
63 | * The driver must call usb_free_urb() when it is finished with the urb. | 61 | * The driver must call usb_free_urb() when it is finished with the urb. |
62 | * | ||
63 | * Return: A pointer to the new urb, or %NULL if no memory is available. | ||
64 | */ | 64 | */ |
65 | struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags) | 65 | struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags) |
66 | { | 66 | { |
@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(usb_free_urb); | |||
103 | * host controller driver. This allows proper reference counting to happen | 103 | * host controller driver. This allows proper reference counting to happen |
104 | * for urbs. | 104 | * for urbs. |
105 | * | 105 | * |
106 | * A pointer to the urb with the incremented reference counter is returned. | 106 | * Return: A pointer to the urb with the incremented reference counter. |
107 | */ | 107 | */ |
108 | struct urb *usb_get_urb(struct urb *urb) | 108 | struct urb *usb_get_urb(struct urb *urb) |
109 | { | 109 | { |
@@ -200,13 +200,12 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); | |||
200 | * the particular kind of transfer, although they will not initialize | 200 | * the particular kind of transfer, although they will not initialize |
201 | * any transfer flags. | 201 | * any transfer flags. |
202 | * | 202 | * |
203 | * Successful submissions return 0; otherwise this routine returns a | 203 | * If the submission is successful, the complete() callback from the URB |
204 | * negative error number. If the submission is successful, the complete() | 204 | * will be called exactly once, when the USB core and Host Controller Driver |
205 | * callback from the URB will be called exactly once, when the USB core and | 205 | * (HCD) are finished with the URB. When the completion function is called, |
206 | * Host Controller Driver (HCD) are finished with the URB. When the completion | 206 | * control of the URB is returned to the device driver which issued the |
207 | * function is called, control of the URB is returned to the device | 207 | * request. The completion handler may then immediately free or reuse that |
208 | * driver which issued the request. The completion handler may then | 208 | * URB. |
209 | * immediately free or reuse that URB. | ||
210 | * | 209 | * |
211 | * With few exceptions, USB device drivers should never access URB fields | 210 | * With few exceptions, USB device drivers should never access URB fields |
212 | * provided by usbcore or the HCD until its complete() is called. | 211 | * provided by usbcore or the HCD until its complete() is called. |
@@ -241,6 +240,9 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); | |||
241 | * that are standardized in the USB 2.0 specification. For bulk | 240 | * that are standardized in the USB 2.0 specification. For bulk |
242 | * endpoints, a synchronous usb_bulk_msg() call is available. | 241 | * endpoints, a synchronous usb_bulk_msg() call is available. |
243 | * | 242 | * |
243 | * Return: | ||
244 | * 0 on successful submissions. A negative error number otherwise. | ||
245 | * | ||
244 | * Request Queuing: | 246 | * Request Queuing: |
245 | * | 247 | * |
246 | * URBs may be submitted to endpoints before previous ones complete, to | 248 | * URBs may be submitted to endpoints before previous ones complete, to |
@@ -572,6 +574,9 @@ EXPORT_SYMBOL_GPL(usb_submit_urb); | |||
572 | * particular, when a driver calls this routine, it must insure that the | 574 | * particular, when a driver calls this routine, it must insure that the |
573 | * completion handler cannot deallocate the URB. | 575 | * completion handler cannot deallocate the URB. |
574 | * | 576 | * |
577 | * Return: -EINPROGRESS on success. See description for other values on | ||
578 | * failure. | ||
579 | * | ||
575 | * Unlinking and Endpoint Queues: | 580 | * Unlinking and Endpoint Queues: |
576 | * | 581 | * |
577 | * [The behaviors and guarantees described below do not apply to virtual | 582 | * [The behaviors and guarantees described below do not apply to virtual |
@@ -846,6 +851,8 @@ EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); | |||
846 | * | 851 | * |
847 | * Call this is you want to be sure all an anchor's | 852 | * Call this is you want to be sure all an anchor's |
848 | * URBs have finished | 853 | * URBs have finished |
854 | * | ||
855 | * Return: Non-zero if the anchor became unused. Zero on timeout. | ||
849 | */ | 856 | */ |
850 | int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, | 857 | int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, |
851 | unsigned int timeout) | 858 | unsigned int timeout) |
@@ -859,8 +866,11 @@ EXPORT_SYMBOL_GPL(usb_wait_anchor_empty_timeout); | |||
859 | * usb_get_from_anchor - get an anchor's oldest urb | 866 | * usb_get_from_anchor - get an anchor's oldest urb |
860 | * @anchor: the anchor whose urb you want | 867 | * @anchor: the anchor whose urb you want |
861 | * | 868 | * |
862 | * this will take the oldest urb from an anchor, | 869 | * This will take the oldest urb from an anchor, |
863 | * unanchor and return it | 870 | * unanchor and return it |
871 | * | ||
872 | * Return: The oldest urb from @anchor, or %NULL if @anchor has no | ||
873 | * urbs associated with it. | ||
864 | */ | 874 | */ |
865 | struct urb *usb_get_from_anchor(struct usb_anchor *anchor) | 875 | struct urb *usb_get_from_anchor(struct usb_anchor *anchor) |
866 | { | 876 | { |
@@ -909,7 +919,7 @@ EXPORT_SYMBOL_GPL(usb_scuttle_anchored_urbs); | |||
909 | * usb_anchor_empty - is an anchor empty | 919 | * usb_anchor_empty - is an anchor empty |
910 | * @anchor: the anchor you want to query | 920 | * @anchor: the anchor you want to query |
911 | * | 921 | * |
912 | * returns 1 if the anchor has no urbs associated with it | 922 | * Return: 1 if the anchor has no urbs associated with it. |
913 | */ | 923 | */ |
914 | int usb_anchor_empty(struct usb_anchor *anchor) | 924 | int usb_anchor_empty(struct usb_anchor *anchor) |
915 | { | 925 | { |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 7dad603dde43..0a6ee2e70b25 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -68,6 +68,8 @@ MODULE_PARM_DESC(autosuspend, "default autosuspend delay"); | |||
68 | * @alt_num: alternate interface setting number to search for. | 68 | * @alt_num: alternate interface setting number to search for. |
69 | * | 69 | * |
70 | * Search the configuration's interface cache for the given alt setting. | 70 | * Search the configuration's interface cache for the given alt setting. |
71 | * | ||
72 | * Return: The alternate setting, if found. %NULL otherwise. | ||
71 | */ | 73 | */ |
72 | struct usb_host_interface *usb_find_alt_setting( | 74 | struct usb_host_interface *usb_find_alt_setting( |
73 | struct usb_host_config *config, | 75 | struct usb_host_config *config, |
@@ -103,8 +105,7 @@ EXPORT_SYMBOL_GPL(usb_find_alt_setting); | |||
103 | * @ifnum: the desired interface | 105 | * @ifnum: the desired interface |
104 | * | 106 | * |
105 | * This walks the device descriptor for the currently active configuration | 107 | * This walks the device descriptor for the currently active configuration |
106 | * and returns a pointer to the interface with that particular interface | 108 | * to find the interface object with the particular interface number. |
107 | * number, or null. | ||
108 | * | 109 | * |
109 | * Note that configuration descriptors are not required to assign interface | 110 | * Note that configuration descriptors are not required to assign interface |
110 | * numbers sequentially, so that it would be incorrect to assume that | 111 | * numbers sequentially, so that it would be incorrect to assume that |
@@ -115,6 +116,9 @@ EXPORT_SYMBOL_GPL(usb_find_alt_setting); | |||
115 | * | 116 | * |
116 | * Don't call this function unless you are bound to one of the interfaces | 117 | * Don't call this function unless you are bound to one of the interfaces |
117 | * on this device or you have locked the device! | 118 | * on this device or you have locked the device! |
119 | * | ||
120 | * Return: A pointer to the interface that has @ifnum as interface number, | ||
121 | * if found. %NULL otherwise. | ||
118 | */ | 122 | */ |
119 | struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, | 123 | struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, |
120 | unsigned ifnum) | 124 | unsigned ifnum) |
@@ -139,8 +143,7 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if); | |||
139 | * @altnum: the desired alternate setting number | 143 | * @altnum: the desired alternate setting number |
140 | * | 144 | * |
141 | * This searches the altsetting array of the specified interface for | 145 | * This searches the altsetting array of the specified interface for |
142 | * an entry with the correct bAlternateSetting value and returns a pointer | 146 | * an entry with the correct bAlternateSetting value. |
143 | * to that entry, or null. | ||
144 | * | 147 | * |
145 | * Note that altsettings need not be stored sequentially by number, so | 148 | * Note that altsettings need not be stored sequentially by number, so |
146 | * it would be incorrect to assume that the first altsetting entry in | 149 | * it would be incorrect to assume that the first altsetting entry in |
@@ -149,6 +152,9 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if); | |||
149 | * | 152 | * |
150 | * Don't call this function unless you are bound to the intf interface | 153 | * Don't call this function unless you are bound to the intf interface |
151 | * or you have locked the device! | 154 | * or you have locked the device! |
155 | * | ||
156 | * Return: A pointer to the entry of the altsetting array of @intf that | ||
157 | * has @altnum as the alternate setting number. %NULL if not found. | ||
152 | */ | 158 | */ |
153 | struct usb_host_interface *usb_altnum_to_altsetting( | 159 | struct usb_host_interface *usb_altnum_to_altsetting( |
154 | const struct usb_interface *intf, | 160 | const struct usb_interface *intf, |
@@ -191,6 +197,8 @@ static int __find_interface(struct device *dev, void *data) | |||
191 | * This walks the bus device list and returns a pointer to the interface | 197 | * This walks the bus device list and returns a pointer to the interface |
192 | * with the matching minor and driver. Note, this only works for devices | 198 | * with the matching minor and driver. Note, this only works for devices |
193 | * that share the USB major number. | 199 | * that share the USB major number. |
200 | * | ||
201 | * Return: A pointer to the interface with the matching major and @minor. | ||
194 | */ | 202 | */ |
195 | struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) | 203 | struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) |
196 | { | 204 | { |
@@ -390,6 +398,9 @@ static unsigned usb_bus_is_wusb(struct usb_bus *bus) | |||
390 | * controllers) should ever call this. | 398 | * controllers) should ever call this. |
391 | * | 399 | * |
392 | * This call may not be used in a non-sleeping context. | 400 | * This call may not be used in a non-sleeping context. |
401 | * | ||
402 | * Return: On success, a pointer to the allocated usb device. %NULL on | ||
403 | * failure. | ||
393 | */ | 404 | */ |
394 | struct usb_device *usb_alloc_dev(struct usb_device *parent, | 405 | struct usb_device *usb_alloc_dev(struct usb_device *parent, |
395 | struct usb_bus *bus, unsigned port1) | 406 | struct usb_bus *bus, unsigned port1) |
@@ -501,7 +512,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, | |||
501 | * their probe() methods, when they bind to an interface, and release | 512 | * their probe() methods, when they bind to an interface, and release |
502 | * them by calling usb_put_dev(), in their disconnect() methods. | 513 | * them by calling usb_put_dev(), in their disconnect() methods. |
503 | * | 514 | * |
504 | * A pointer to the device with the incremented reference counter is returned. | 515 | * Return: A pointer to the device with the incremented reference counter. |
505 | */ | 516 | */ |
506 | struct usb_device *usb_get_dev(struct usb_device *dev) | 517 | struct usb_device *usb_get_dev(struct usb_device *dev) |
507 | { | 518 | { |
@@ -535,8 +546,7 @@ EXPORT_SYMBOL_GPL(usb_put_dev); | |||
535 | * their probe() methods, when they bind to an interface, and release | 546 | * their probe() methods, when they bind to an interface, and release |
536 | * them by calling usb_put_intf(), in their disconnect() methods. | 547 | * them by calling usb_put_intf(), in their disconnect() methods. |
537 | * | 548 | * |
538 | * A pointer to the interface with the incremented reference counter is | 549 | * Return: A pointer to the interface with the incremented reference counter. |
539 | * returned. | ||
540 | */ | 550 | */ |
541 | struct usb_interface *usb_get_intf(struct usb_interface *intf) | 551 | struct usb_interface *usb_get_intf(struct usb_interface *intf) |
542 | { | 552 | { |
@@ -589,7 +599,7 @@ EXPORT_SYMBOL_GPL(usb_put_intf); | |||
589 | * disconnect; in some drivers (such as usb-storage) the disconnect() | 599 | * disconnect; in some drivers (such as usb-storage) the disconnect() |
590 | * or suspend() method will block waiting for a device reset to complete. | 600 | * or suspend() method will block waiting for a device reset to complete. |
591 | * | 601 | * |
592 | * Returns a negative error code for failure, otherwise 0. | 602 | * Return: A negative error code for failure, otherwise 0. |
593 | */ | 603 | */ |
594 | int usb_lock_device_for_reset(struct usb_device *udev, | 604 | int usb_lock_device_for_reset(struct usb_device *udev, |
595 | const struct usb_interface *iface) | 605 | const struct usb_interface *iface) |
@@ -628,14 +638,15 @@ EXPORT_SYMBOL_GPL(usb_lock_device_for_reset); | |||
628 | * usb_get_current_frame_number - return current bus frame number | 638 | * usb_get_current_frame_number - return current bus frame number |
629 | * @dev: the device whose bus is being queried | 639 | * @dev: the device whose bus is being queried |
630 | * | 640 | * |
631 | * Returns the current frame number for the USB host controller | 641 | * Return: The current frame number for the USB host controller used |
632 | * used with the given USB device. This can be used when scheduling | 642 | * with the given USB device. This can be used when scheduling |
633 | * isochronous requests. | 643 | * isochronous requests. |
634 | * | 644 | * |
635 | * Note that different kinds of host controller have different | 645 | * Note: Different kinds of host controller have different "scheduling |
636 | * "scheduling horizons". While one type might support scheduling only | 646 | * horizons". While one type might support scheduling only 32 frames |
637 | * 32 frames into the future, others could support scheduling up to | 647 | * into the future, others could support scheduling up to 1024 frames |
638 | * 1024 frames into the future. | 648 | * into the future. |
649 | * | ||
639 | */ | 650 | */ |
640 | int usb_get_current_frame_number(struct usb_device *dev) | 651 | int usb_get_current_frame_number(struct usb_device *dev) |
641 | { | 652 | { |
@@ -685,11 +696,12 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); | |||
685 | * @mem_flags: affect whether allocation may block | 696 | * @mem_flags: affect whether allocation may block |
686 | * @dma: used to return DMA address of buffer | 697 | * @dma: used to return DMA address of buffer |
687 | * | 698 | * |
688 | * Return value is either null (indicating no buffer could be allocated), or | 699 | * Return: Either null (indicating no buffer could be allocated), or the |
689 | * the cpu-space pointer to a buffer that may be used to perform DMA to the | 700 | * cpu-space pointer to a buffer that may be used to perform DMA to the |
690 | * specified device. Such cpu-space buffers are returned along with the DMA | 701 | * specified device. Such cpu-space buffers are returned along with the DMA |
691 | * address (through the pointer provided). | 702 | * address (through the pointer provided). |
692 | * | 703 | * |
704 | * Note: | ||
693 | * These buffers are used with URB_NO_xxx_DMA_MAP set in urb->transfer_flags | 705 | * These buffers are used with URB_NO_xxx_DMA_MAP set in urb->transfer_flags |
694 | * to avoid behaviors like using "DMA bounce buffers", or thrashing IOMMU | 706 | * to avoid behaviors like using "DMA bounce buffers", or thrashing IOMMU |
695 | * hardware during URB completion/resubmit. The implementation varies between | 707 | * hardware during URB completion/resubmit. The implementation varies between |
@@ -735,17 +747,18 @@ EXPORT_SYMBOL_GPL(usb_free_coherent); | |||
735 | * usb_buffer_map - create DMA mapping(s) for an urb | 747 | * usb_buffer_map - create DMA mapping(s) for an urb |
736 | * @urb: urb whose transfer_buffer/setup_packet will be mapped | 748 | * @urb: urb whose transfer_buffer/setup_packet will be mapped |
737 | * | 749 | * |
738 | * Return value is either null (indicating no buffer could be mapped), or | 750 | * URB_NO_TRANSFER_DMA_MAP is added to urb->transfer_flags if the operation |
739 | * the parameter. URB_NO_TRANSFER_DMA_MAP is | 751 | * succeeds. If the device is connected to this system through a non-DMA |
740 | * added to urb->transfer_flags if the operation succeeds. If the device | 752 | * controller, this operation always succeeds. |
741 | * is connected to this system through a non-DMA controller, this operation | ||
742 | * always succeeds. | ||
743 | * | 753 | * |
744 | * This call would normally be used for an urb which is reused, perhaps | 754 | * This call would normally be used for an urb which is reused, perhaps |
745 | * as the target of a large periodic transfer, with usb_buffer_dmasync() | 755 | * as the target of a large periodic transfer, with usb_buffer_dmasync() |
746 | * calls to synchronize memory and dma state. | 756 | * calls to synchronize memory and dma state. |
747 | * | 757 | * |
748 | * Reverse the effect of this call with usb_buffer_unmap(). | 758 | * Reverse the effect of this call with usb_buffer_unmap(). |
759 | * | ||
760 | * Return: Either %NULL (indicating no buffer could be mapped), or @urb. | ||
761 | * | ||
749 | */ | 762 | */ |
750 | #if 0 | 763 | #if 0 |
751 | struct urb *usb_buffer_map(struct urb *urb) | 764 | struct urb *usb_buffer_map(struct urb *urb) |
@@ -850,9 +863,10 @@ EXPORT_SYMBOL_GPL(usb_buffer_unmap); | |||
850 | * @sg: the scatterlist to map | 863 | * @sg: the scatterlist to map |
851 | * @nents: the number of entries in the scatterlist | 864 | * @nents: the number of entries in the scatterlist |
852 | * | 865 | * |
853 | * Return value is either < 0 (indicating no buffers could be mapped), or | 866 | * Return: Either < 0 (indicating no buffers could be mapped), or the |
854 | * the number of DMA mapping array entries in the scatterlist. | 867 | * number of DMA mapping array entries in the scatterlist. |
855 | * | 868 | * |
869 | * Note: | ||
856 | * The caller is responsible for placing the resulting DMA addresses from | 870 | * The caller is responsible for placing the resulting DMA addresses from |
857 | * the scatterlist into URB transfer buffer pointers, and for setting the | 871 | * the scatterlist into URB transfer buffer pointers, and for setting the |
858 | * URB_NO_TRANSFER_DMA_MAP transfer flag in each of those URBs. | 872 | * URB_NO_TRANSFER_DMA_MAP transfer flag in each of those URBs. |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 6efdab089014..acb1b0aa77d8 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -708,7 +708,10 @@ extern int usb_driver_claim_interface(struct usb_driver *driver, | |||
708 | * usb_interface_claimed - returns true iff an interface is claimed | 708 | * usb_interface_claimed - returns true iff an interface is claimed |
709 | * @iface: the interface being checked | 709 | * @iface: the interface being checked |
710 | * | 710 | * |
711 | * Returns true (nonzero) iff the interface is claimed, else false (zero). | 711 | * Return: %true (nonzero) iff the interface is claimed, else %false |
712 | * (zero). | ||
713 | * | ||
714 | * Note: | ||
712 | * Callers must own the driver model's usb bus readlock. So driver | 715 | * Callers must own the driver model's usb bus readlock. So driver |
713 | * probe() entries don't need extra locking, but other call contexts | 716 | * probe() entries don't need extra locking, but other call contexts |
714 | * may need to explicitly claim that lock. | 717 | * may need to explicitly claim that lock. |
@@ -745,8 +748,9 @@ extern struct usb_host_interface *usb_find_alt_setting( | |||
745 | * @buf: where to put the string | 748 | * @buf: where to put the string |
746 | * @size: how big is "buf"? | 749 | * @size: how big is "buf"? |
747 | * | 750 | * |
748 | * Returns length of the string (> 0) or negative if size was too small. | 751 | * Return: Length of the string (> 0) or negative if size was too small. |
749 | * | 752 | * |
753 | * Note: | ||
750 | * This identifier is intended to be "stable", reflecting physical paths in | 754 | * This identifier is intended to be "stable", reflecting physical paths in |
751 | * hardware such as physical bus addresses for host controllers or ports on | 755 | * 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 | 756 | * USB hubs. That makes it stay the same until systems are physically |
@@ -1578,7 +1582,7 @@ extern int usb_anchor_empty(struct usb_anchor *anchor); | |||
1578 | * usb_urb_dir_in - check if an URB describes an IN transfer | 1582 | * usb_urb_dir_in - check if an URB describes an IN transfer |
1579 | * @urb: URB to be checked | 1583 | * @urb: URB to be checked |
1580 | * | 1584 | * |
1581 | * Returns 1 if @urb describes an IN transfer (device-to-host), | 1585 | * Return: 1 if @urb describes an IN transfer (device-to-host), |
1582 | * otherwise 0. | 1586 | * otherwise 0. |
1583 | */ | 1587 | */ |
1584 | static inline int usb_urb_dir_in(struct urb *urb) | 1588 | static inline int usb_urb_dir_in(struct urb *urb) |
@@ -1590,7 +1594,7 @@ static inline int usb_urb_dir_in(struct urb *urb) | |||
1590 | * usb_urb_dir_out - check if an URB describes an OUT transfer | 1594 | * usb_urb_dir_out - check if an URB describes an OUT transfer |
1591 | * @urb: URB to be checked | 1595 | * @urb: URB to be checked |
1592 | * | 1596 | * |
1593 | * Returns 1 if @urb describes an OUT transfer (host-to-device), | 1597 | * Return: 1 if @urb describes an OUT transfer (host-to-device), |
1594 | * otherwise 0. | 1598 | * otherwise 0. |
1595 | */ | 1599 | */ |
1596 | static inline int usb_urb_dir_out(struct urb *urb) | 1600 | static inline int usb_urb_dir_out(struct urb *urb) |