diff options
author | Johan Hovold <jhovold@gmail.com> | 2011-11-10 14:58:26 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2012-05-31 00:43:31 +0100 |
commit | 9323f37754016b3fa76419d0e0ad9a56fcf0dd96 (patch) | |
tree | 71a9f29a3f3ed01f8c1042c95892122b0984e20f /include | |
parent | a756191d7f7f975492a9cc0f43829fcdbe366fe5 (diff) |
USB: move usb_translate_errors to linux/usb.h
commit 2c4d6bf295ae10ffcd84f0df6cb642598eb66603 upstream.
Move usb_translate_errors from usb core to linux/usb.h as it is meant to
be accessed from drivers.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 75033529c05..4269c3f8814 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1599,6 +1599,19 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out) /* ----------------------------------------------------------------------- */ +/* translate USB error codes to codes user space understands */ +static inline int usb_translate_errors(int error_code) +{ + switch (error_code) { + case 0: + case -ENOMEM: + case -ENODEV: + return error_code; + default: + return -EIO; + } +} + /* Events from the usb core */ #define USB_DEVICE_ADD 0x0001 #define USB_DEVICE_REMOVE 0x0002 |