From aee2dc1d7fd03d3900e06e88793b519e21049de0 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Thu, 15 Aug 2013 14:40:20 +0200 Subject: [PATCH] backports: add usb_translate_errors() This inline function is missing for version < 2.6.39 but required by em28xx and cdc-wdm device driver. Signed-off-by: Patrick Ziegler Signed-off-by: Luis R. Rodriguez --- backport/backport-include/linux/usb.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backport/backport-include/linux/usb.h b/backport/backport-include/linux/usb.h index 368da6c74bd9..a717b7a07362 100644 --- a/backport/backport-include/linux/usb.h +++ b/backport/backport-include/linux/usb.h @@ -145,4 +145,19 @@ extern void usb_unpoison_urb(struct urb *urb); extern int usb_anchor_empty(struct usb_anchor *anchor); #endif /* 2.6.23-2.6.27 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) +static inline int usb_translate_errors(int error_code) +{ + switch (error_code) { + case 0: + case -ENOMEM: + case -ENODEV: + case -EOPNOTSUPP: + return error_code; + default: + return -EIO; + } +} +#endif /* < 2.6.39 */ + #endif /* __BACKPORT_USB_H */ -- 2.30.2