From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Jeff Garzik <jeff@garzik.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [RFC] Remove or convert empty ioctls ?
Date: Thu, 15 Oct 2009 16:49:06 +0100 [thread overview]
Message-ID: <20091015164906.5b2c03db@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <4AD74151.7020306@garzik.org>
On Thu, 15 Oct 2009 11:35:45 -0400
Jeff Garzik <jeff@garzik.org> wrote:
> On 10/15/2009 11:31 AM, Alan Cox wrote:
> > EINVAL means you used an ioctl that is correct for the driver but that
> > for some reason the driver didn't like it.
>
> Precisely.
>
> The driver author proactively chose to implement the ioctl and return a
> value other than ENOTTY.
Jeff - wake up - take coffee if neeeded.
The case in question is the case where ->unlocked_ioctl() == NULL. In
that case the driver author didn't implement anything and the correct
return from the layer doing the handling is -ENOTTY.
In the case where there is an ioctl handler the common
foo_ioctl()
{
return -EINVAL;
}
stub case is simply broken, and caused by the fact a lot of early Linux
drivers were wrong and people keep propogating mistakes (a serious
problem in the open source world is that most code is produced by copying
stuff but often by copying buggy code).
Essentially the only times you should be returning -EINVAL is where the
driver actually has
case IOCWIBBLE:
/* Do stuff */
if (foo < 1)
return -EINVAL;
All the "I don't know this" cases should be -ENOTTY.
There are cases where
case IOCWIBBLE:
return -EINVAL;
is correct but they are unusual - basically the case where the driver
author wants to "support" the ioctl but there is no argument that it can
be given which is correct.
Anyway the case discussed which is ".unlocked_ioctl = NULL" should return
-ENOTTY, and there isn't any argument about the driver authors intentions.
next prev parent reply other threads:[~2009-10-15 15:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 9:20 [RFC] Remove or convert empty ioctls ? Thomas Gleixner
2009-10-15 12:12 ` Jeff Garzik
2009-10-15 15:01 ` Alan Cox
2009-10-15 15:22 ` Jeff Garzik
2009-10-15 15:31 ` Alan Cox
2009-10-15 15:35 ` Jeff Garzik
2009-10-15 15:49 ` Alan Cox [this message]
2009-10-15 16:03 ` Jeff Garzik
2009-10-15 16:23 ` Thomas Gleixner
2009-10-15 16:28 ` Thomas Gleixner
2009-10-15 15:50 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091015164906.5b2c03db@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=arnd@arndb.de \
--cc=fweisbec@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox