[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <557D8874.6040002@mev.co.uk>
Date: Sun, 14 Jun 2015 14:58:12 +0100
From: Ian Abbott <abbotti@....co.uk>
To: julien.dehee@...il.com, gregkh@...uxfoundation.org,
hsweeten@...ionengravers.com, tapaswenipathak@...il.com,
hamohammed.sa@...il.com, viro@...iv.linux.org.uk,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: comedi: replace ENOSYS by proper error codes
On 12/06/15 21:20, julien.dehee@...il.com wrote:
> From: Julien Dehee <julien.dehee@...il.com>
>
> comedi/comedi_fops.c
> use ENODEV following open manual
>
> comedi/drivers.c
> use ENOTTY following ioctl manual
>
> drivers/serial2002.c
> use ENOTTY following ioctl manual
>
> Signed-off-by: Julien Dehee <julien.dehee@...il.com>
> ---
> drivers/staging/comedi/comedi_fops.c | 2 +-
> drivers/staging/comedi/drivers.c | 2 +-
> drivers/staging/comedi/drivers/serial2002.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
> index 146ab00..6896a1f 100644
> --- a/drivers/staging/comedi/comedi_fops.c
> +++ b/drivers/staging/comedi/comedi_fops.c
> @@ -2611,7 +2611,7 @@ static int comedi_open(struct inode *inode, struct file *file)
> }
> if (dev->attached && dev->use_count == 0) {
> if (!try_module_get(dev->driver->module)) {
> - rc = -ENOSYS;
> + rc = -ENODEV;
> goto out;
Seems reasonable as driver for the device is being unloaded.
> }
> if (dev->open) {
> diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
> index ed0b60c..db89096 100644
> --- a/drivers/staging/comedi/drivers.c
> +++ b/drivers/staging/comedi/drivers.c
> @@ -820,7 +820,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
> "driver '%s' does not support attach using comedi_config\n",
> driv->driver_name);
> module_put(driv->module);
> - ret = -ENOSYS;
> + ret = -ENOTTY;
> goto out;
I don't think ENOTTY is the correct error code here. the
COMEDI_DEVCONFIG ioctl code is an "appropriate" ioctl to send to a
comedi device. I'd suggest ENOTSUP as a replacement.
> }
> dev->driver = driv;
> diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
> index 83da162..929bf20 100644
> --- a/drivers/staging/comedi/drivers/serial2002.c
> +++ b/drivers/staging/comedi/drivers/serial2002.c
> @@ -101,7 +101,7 @@ static long serial2002_tty_ioctl(struct file *f, unsigned op,
> if (f->f_op->unlocked_ioctl)
> return f->f_op->unlocked_ioctl(f, op, param);
>
> - return -ENOSYS;
> + return -ENOTTY;
That is reasonable. It shouldn't happen anyway if 'f' really is linked
to a tty device. And the return value is currently ignored anyway!
> }
>
> static int serial2002_tty_write(struct file *f, unsigned char *buf, int count)
>
As Greg mentioned, it should be three different patches.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@....co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists