Thread (5 messages) flat view 5 messages, 4 authors, 2016-01-22

Re: [PATCH] usbhid: replace inappropriate ENOSYS with ENODEV

From: Jiri Kosina <jikos@kernel.org>
Date: 2016-01-22 23:30:26

On Thu, 21 Jan 2016, Dmitry Torokhov wrote:
On Thu, Jan 21, 2016 at 6:18 AM, Jiri Kosina [off-list ref] wrote:
quoted
On Wed, 20 Jan 2016, Heiner Kallweit wrote:
quoted
Primary meaning of ENOSYS is "system call not available" but it's also used
with meaning "function not implemented". Both are not applicable here.

Typically this error occurs when the device was unplugged.
usbhid_raw_request returns -ENODEV in such a case what seems to be more
reasonable. Therefore use -ENODEV also here.

Primary motivation for this change is a change in the LED subsystem to
ignore -ENODEV if the device was most likely unplugged.
I believe POSIX defines ENOSYS as "Function not implemented". In this
case, we are signalling there is no "URB OUT" function.
Well, it looks like ENOSYS is really reserved for unimplemented system calls:

commit 91c9afaf97ee554d2cd3042a5ad01ad21c99e8c4
Author: Andy Lutomirski [off-list ref]
Date:   Thu Apr 16 12:44:44 2015 -0700

    checkpatch.pl: new instances of ENOSYS are errors

    ENOSYS means that a nonexistent system call was called.  We have a
    bad habit of using it for things like invalid operations on
    otherwise valid syscalls.  We should avoid this in new code.

    Pervasive incorrect usage of ENOSYS came up at the kernel summit ABI
    review discussion.  Let's see if checkpatch can help.

    I'll submit a separate patch for include/uapi/asm-generic/errno.h.
Let's add Andy to CC.

Andy, my understanding of POSIX is that ENOSYS is "function not 
implemented", meaning whatever internal function of kernel, not strictly 
just syscall entrypoint.

Where does your explanation of ENOSYS as "syscall not implemented" come 
from, please?

Thanks,

-- 
Jiri Kosina
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help