On Wed, 2006-03-08 at 23:58 -0800, Clemens Ladisch wrote:
> +static const char *usb_error_string(int err)
> +{
> + switch (err) {
> + case -ENODEV:
> + return "no device";
> + case -ENOENT:
> + return "endpoint not enabled";
> + case -EPIPE:
> + return "endpoint stalled";
> + case -ENOSPC:
> + return "not enough bandwidth";
> + case -ESHUTDOWN:
> + return "device disabled";
> + case -EHOSTUNREACH:
> + return "device suspended";
> + case -EINVAL:
> + case -EAGAIN:
> + case -EFBIG:
> + case -EMSGSIZE:
> + return "internal error";
> + default:
> + return "unknown error";
> + }
> +}
Shouldn't a generic facility be created for this? After all these are
standard error codes and it seem like other parts of the kernel might
want to do user friendly error reporting.
Lee
Lee Revell wrote:
> On Wed, 2006-03-08 at 23:58 -0800, Clemens Ladisch wrote:
> > +static const char *usb_error_string(int err)
> > +{
> > + switch (err) {
> > + case -ENODEV:
> > + return "no device";
> > + case -ENOENT:
> > + return "endpoint not enabled";
> > + case -EPIPE:
> > + return "endpoint stalled";
> > + case -ENOSPC:
> > + return "not enough bandwidth";
> > + case -ESHUTDOWN:
> > + return "device disabled";
> > + case -EHOSTUNREACH:
> > + return "device suspended";
> > + case -EINVAL:
> > + case -EAGAIN:
> > + case -EFBIG:
> > + case -EMSGSIZE:
> > + return "internal error";
> > + default:
> > + return "unknown error";
> > + }
> > +}
>
> Shouldn't a generic facility be created for this?
Yes, there's nothing audio specific in this function (except for my
decision which codes to lump together as "internal error").
> After all these are standard error codes and it seem like other parts
> of the kernel might want to do user friendly error reporting.
But it seems none of those parts actually does. ;-)
Clemens