Commit b3969e58 authored by Alessandro Zummo's avatar Alessandro Zummo Committed by Linus Torvalds

[PATCH] rtc subsystem: use ENOIOCTLCMD and ENOTTY where appropriate

Appropriately use -ENOIOCTLCMD and -ENOTTY when the ioctl is not
implemented by a driver.

(akpm: we're not allowed to return -ENOIOCTLCMD to userspace.  This patch does
the right thing).
Signed-off-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eae07ac6
...@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, ...@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
/* try the driver's ioctl interface */ /* try the driver's ioctl interface */
if (ops->ioctl) { if (ops->ioctl) {
err = ops->ioctl(class_dev->dev, cmd, arg); err = ops->ioctl(class_dev->dev, cmd, arg);
if (err != -EINVAL) if (err != -ENOIOCTLCMD)
return err; return err;
} }
/* if the driver does not provide the ioctl interface /* if the driver does not provide the ioctl interface
* or if that particular ioctl was not implemented * or if that particular ioctl was not implemented
* (-EINVAL), we will try to emulate here. * (-ENOIOCTLCMD), we will try to emulate here.
*/ */
switch (cmd) { switch (cmd) {
...@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, ...@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
break; break;
default: default:
err = -EINVAL; err = -ENOTTY;
break; break;
} }
......
...@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd, ...@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd,
rtc_freq = arg; rtc_freq = arg;
return 0; return 0;
} }
return -EINVAL; return -ENOIOCTLCMD;
} }
static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm)
......
...@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct device *dev, unsigned int cmd, ...@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct device *dev, unsigned int cmd,
return 0; return 0;
default: default:
return -EINVAL; return -ENOIOCTLCMD;
} }
} }
......
...@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ...@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
epoch = arg; epoch = arg;
break; break;
default: default:
return -EINVAL; return -ENOIOCTLCMD;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment