Am Mittwoch, 13. Oktober 2010, 19:34:48 schrieb Alan Stern: > On Wed, 13 Oct 2010, Oliver Neukum wrote: > > > Hi, > > > > drivers need to return errors to user space. > > A common source for them are urb->status and the > > return value of usb_submit_urb(). They cannot be returned as > > is to user space, as for example -EPIPE has a very > > different meaning in user space. I'd like to add this small > > helper for conversion. > > What do you think? > > > > Regards > > Oliver > > > > > > +/* 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; > > + } > > +} > > Should this be a non-inline function? I am agnostic on that. It just seemed simple enough to inline. Regards Oliver -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html