aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2010-12-19 15:54:48 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-22 22:35:38 -0500
commit60678b60d78cd268a3aed3044dfbbb85760b2c54 (patch)
tree878df8903a37092318d0a1987c98a538c16fb044 /drivers/usb/core
parent1bae4ce27c9c90344f23c65ea6966c50ffeae2f5 (diff)
USB: add helper to convert USB error codes
This converts error codes specific to USB to generic error codes that can be returned to user space. Tests showed that it is so small that it is better inlined. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/usb.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index b975450f403..a9cf484ecae 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -122,6 +122,19 @@ static inline int is_usb_device_driver(struct device_driver *drv)
122 for_devices; 122 for_devices;
123} 123}
124 124
125/* translate USB error codes to codes user space understands */
126static inline int usb_translate_errors(int error_code)
127{
128 switch (error_code) {
129 case 0:
130 case -ENOMEM:
131 case -ENODEV:
132 return error_code;
133 default:
134 return -EIO;
135 }
136}
137
125 138
126/* for labeling diagnostics */ 139/* for labeling diagnostics */
127extern const char *usbcore_name; 140extern const char *usbcore_name;