Re: [PATCH] rtc subsystem, use ENOIOCTLCMD where appropriate

From: H. Peter Anvin
Date: Thu May 18 2006 - 16:31:00 EST


Followup to: <20060517232742.2ac4ccaa@inspiron>
By author: Alessandro Zummo <alessandro.zummo@xxxxxxxxxxxx>
In newsgroup: linux.dev.kernel
> >
> > and ENOTTY is the return value for "Inappropriate ioctl for device":
> >
>
> you're right. I'll go for ENOTTY. thanks.
>

ENOIOCTLCMD is right here, *except* in the very last hunk, because
it's a request to the upper layers to emulate the operation:

> --- linux-rtc.orig/drivers/rtc/rtc-dev.c 2006-05-17 01:18:19.000000000 +0200
> +++ linux-rtc/drivers/rtc/rtc-dev.c 2006-05-17 01:26:01.000000000 +0200
> @@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *i
> /* try the driver's ioctl interface */
> if (ops->ioctl) {
> err = ops->ioctl(class_dev->dev, cmd, arg);
> - if (err != -EINVAL)
> + if (err != -ENOIOCTLCMD)
> return err;
> }
>
> /* if the driver does not provide the ioctl interface
> * or if that particular ioctl was not implemented
> - * (-EINVAL), we will try to emulate here.
> + * (-ENOIOCTLCMD), we will try to emulate here.
> */
>
> switch (cmd) {
> @@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *i
> break;
>
> default:
> - err = -EINVAL;
> + err = -ENOIOCTLCMD;
> break;
> }
>

The last hunk should be ENOTTY.

-hpa


---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/