]> err.no Git - linux-2.6/commitdiff
[PATCH] rtc subsystem: use ENOIOCTLCMD and ENOTTY where appropriate
authorAlessandro Zummo <alessandro.zummo@towertech.it>
Sat, 20 May 2006 22:00:29 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 21 May 2006 19:59:21 +0000 (12:59 -0700)
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: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/rtc/rtc-dev.c
drivers/rtc/rtc-sa1100.c
drivers/rtc/rtc-test.c
drivers/rtc/rtc-vr41xx.c

index 6c9ad92747fddd2c35061c5e49a4bcc1ad04e2cd..2011567005f99a55b5072b1b7600fc616a1bd5a7 100644 (file)
@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
        /* 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 *inode, struct file *file,
                break;
 
        default:
-               err = -EINVAL;
+               err = -ENOTTY;
                break;
        }
 
index 2bc8aad47219180f58799a4b89523a9cf8298234..a997529f8926e24e0d3161acabb4c30215c2d21f 100644 (file)
@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd,
                rtc_freq = arg;
                return 0;
        }
-       return -EINVAL;
+       return -ENOIOCTLCMD;
 }
 
 static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm)
index e1f7e8e86daffee9f96737442ef9d840904f6a0e..e1fa5fe7901f900167b448997cb4f4373a85e892 100644 (file)
@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct device *dev, unsigned int cmd,
                return 0;
 
        default:
-               return -EINVAL;
+               return -ENOIOCTLCMD;
        }
 }
 
index 4d49fd501198fee4b8d1d0080c829935a80f50d2..277596c302e30426262db9392be87355cfeb7114 100644 (file)
@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
                epoch = arg;
                break;
        default:
-               return -EINVAL;
+               return -ENOIOCTLCMD;
        }
 
        return 0;