[WATCHDOG] use ENOTTY instead of ENOIOCTLCMD in ioctl()
authorSamuel Tardieu <sam@rfc1149.net>
Sat, 9 Sep 2006 15:34:31 +0000 (17:34 +0200)
committerWim Van Sebroeck <wim@iguana.be>
Mon, 2 Oct 2006 21:08:34 +0000 (23:08 +0200)
Return ENOTTY instead of ENOIOCTLCMD in user-visible ioctl() results

The watchdog drivers used to return ENOIOCTLCMD for bad ioctl() commands.
ENOIOCTLCMD should not be visible by the user, so use ENOTTY instead.

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
43 files changed:
drivers/char/watchdog/acquirewdt.c
drivers/char/watchdog/advantechwdt.c
drivers/char/watchdog/alim1535_wdt.c
drivers/char/watchdog/alim7101_wdt.c
drivers/char/watchdog/at91_wdt.c
drivers/char/watchdog/booke_wdt.c
drivers/char/watchdog/cpu5wdt.c
drivers/char/watchdog/ep93xx_wdt.c
drivers/char/watchdog/eurotechwdt.c
drivers/char/watchdog/i6300esb.c
drivers/char/watchdog/i8xx_tco.c
drivers/char/watchdog/ib700wdt.c
drivers/char/watchdog/ibmasr.c
drivers/char/watchdog/indydog.c
drivers/char/watchdog/ixp2000_wdt.c
drivers/char/watchdog/ixp4xx_wdt.c
drivers/char/watchdog/machzwd.c
drivers/char/watchdog/mixcomwd.c
drivers/char/watchdog/mpc83xx_wdt.c
drivers/char/watchdog/mpc8xx_wdt.c
drivers/char/watchdog/mpcore_wdt.c
drivers/char/watchdog/mv64x60_wdt.c
drivers/char/watchdog/pcwd.c
drivers/char/watchdog/pcwd_pci.c
drivers/char/watchdog/pcwd_usb.c
drivers/char/watchdog/s3c2410_wdt.c
drivers/char/watchdog/sa1100_wdt.c
drivers/char/watchdog/sbc60xxwdt.c
drivers/char/watchdog/sbc_epx_c3.c
drivers/char/watchdog/sc1200wdt.c
drivers/char/watchdog/sc520_wdt.c
drivers/char/watchdog/scx200_wdt.c
drivers/char/watchdog/shwdt.c
drivers/char/watchdog/softdog.c
drivers/char/watchdog/w83627hf_wdt.c
drivers/char/watchdog/w83877f_wdt.c
drivers/char/watchdog/w83977f_wdt.c
drivers/char/watchdog/wafer5823wdt.c
drivers/char/watchdog/wdrtas.c
drivers/char/watchdog/wdt.c
drivers/char/watchdog/wdt285.c
drivers/char/watchdog/wdt977.c
drivers/char/watchdog/wdt_pci.c

index c77fe3c..154d67e 100644 (file)
@@ -183,7 +183,7 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        }
 
        default:
-         return -ENOIOCTLCMD;
+         return -ENOTTY;
        }
 }
 
index 8069be4..9d73276 100644 (file)
@@ -176,7 +176,7 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        }
 
        default:
-         return -ENOIOCTLCMD;
+         return -ENOTTY;
        }
        return 0;
 }
index 0b2c8e8..01b0d13 100644 (file)
@@ -236,7 +236,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
                        return put_user(timeout, p);
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index 383f9bf..5948863 100644 (file)
@@ -277,7 +277,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
                case WDIOC_GETTIMEOUT:
                        return put_user(timeout, p);
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index cc26671..4e7a114 100644 (file)
@@ -168,7 +168,7 @@ static int at91_wdt_ioctl(struct inode *inode, struct file *file,
                        return 0;
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index e3cefc5..4889022 100644 (file)
@@ -125,7 +125,7 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
                        return -EINVAL;
                return 0;
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 
        return 0;
index 04c7e49..00bdabb 100644 (file)
@@ -183,7 +183,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
                        }
                        break;
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
        return 0;
 }
index 77c8a95..01cf123 100644 (file)
@@ -144,7 +144,7 @@ static int
 ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                 unsigned long arg)
 {
-       int ret = -ENOIOCTLCMD;
+       int ret = -ENOTTY;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
index 62dbccb..4f42697 100644 (file)
@@ -240,7 +240,7 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
 
        switch(cmd) {
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
 
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
index 870539e..fb64df4 100644 (file)
@@ -315,7 +315,7 @@ static int esb_ioctl (struct inode *inode, struct file *file,
                         return put_user(heartbeat, p);
 
                 default:
-                        return -ENOIOCTLCMD;
+                        return -ENOTTY;
         }
 }
 
index 3c6daca..e0627d7 100644 (file)
@@ -356,7 +356,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
                }
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index fd95f73..c1ed209 100644 (file)
@@ -199,7 +199,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
          break;
 
        default:
-         return -ENOIOCTLCMD;
+         return -ENOTTY;
        }
        return 0;
 }
index 26ceee7..dd6760f 100644 (file)
@@ -295,7 +295,7 @@ static int asr_ioctl(struct inode *inode, struct file *file,
                }
        }
 
-       return -ENOIOCTLCMD;
+       return -ENOTTY;
 }
 
 static int asr_open(struct inode *inode, struct file *file)
index dacc1c2..0bc2393 100644 (file)
@@ -112,7 +112,7 @@ static int indydog_ioctl(struct inode *inode, struct file *file,
 
        switch (cmd) {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        if (copy_to_user((struct watchdog_info *)arg,
                                         &ident, sizeof(ident)))
index 6929088..c91d9a6 100644 (file)
@@ -107,7 +107,7 @@ static int
 ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        unsigned long arg)
 {
-       int ret = -ENOIOCTLCMD;
+       int ret = -ENOTTY;
        int time;
 
        switch (cmd) {
index 9db5cf2..db477f7 100644 (file)
@@ -102,7 +102,7 @@ static int
 ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        unsigned long arg)
 {
-       int ret = -ENOIOCTLCMD;
+       int ret = -ENOTTY;
        int time;
 
        switch (cmd) {
index 23734e0..ed2b6e1 100644 (file)
@@ -329,7 +329,7 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        break;
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 
        return 0;
index ae94332..c2dac0a 100644 (file)
@@ -185,7 +185,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
                        mixcomwd_ping();
                        break;
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
        return 0;
 }
index a480903..18ca752 100644 (file)
@@ -125,7 +125,7 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
        case WDIOC_GETTIMEOUT:
                return put_user(timeout_sec, p);
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 }
 
index 35dd9e6..8aaed10 100644 (file)
@@ -126,7 +126,7 @@ static int mpc8xx_wdt_ioctl(struct inode *inode, struct file *file,
                break;
 
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 
        return 0;
index 54b3c56..02d336a 100644 (file)
@@ -221,7 +221,7 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
        } uarg;
 
        if (_IOC_DIR(cmd) && _IOC_SIZE(cmd) > sizeof(uarg))
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
 
        if (_IOC_DIR(cmd) & _IOC_WRITE) {
                ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd));
@@ -271,7 +271,7 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
                break;
 
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 
        if (ret == 0 && _IOC_DIR(cmd) & _IOC_READ) {
index 5c8fab3..b887cdb 100644 (file)
@@ -160,7 +160,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
                break;
 
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 
        return 0;
index cd7d1b6..6f8515d 100644 (file)
@@ -572,7 +572,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
 
        switch(cmd) {
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
 
        case WDIOC_GETSUPPORT:
                if(copy_to_user(argp, &ident, sizeof(ident)))
index c7cfd6d..2de6e49 100644 (file)
@@ -541,7 +541,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
                }
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index b7ae73d..77662cb 100644 (file)
@@ -445,7 +445,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
                }
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index a49f1f2..b36a04a 100644 (file)
@@ -288,7 +288,7 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file,
 
        switch (cmd) {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
 
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &s3c2410_wdt_ident,
index 1fc16d9..33c1137 100644 (file)
@@ -90,7 +90,7 @@ static struct watchdog_info ident = {
 static int sa1100dog_ioctl(struct inode *inode, struct file *file,
        unsigned int cmd, unsigned long arg)
 {
-       int ret = -ENOIOCTLCMD;
+       int ret = -ENOTTY;
        int time;
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
index 4663c2f..c7b2045 100644 (file)
@@ -235,7 +235,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        switch(cmd)
        {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
                case WDIOC_GETSTATUS:
index bfc475d..8882b42 100644 (file)
@@ -141,7 +141,7 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
 
                return retval;
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 }
 
index 7c3cf29..d8d0f28 100644 (file)
@@ -180,7 +180,7 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
 
        switch (cmd) {
                default:
-                       return -ENOIOCTLCMD;    /* Keep Pavel Machek amused ;) */
+                       return -ENOTTY;
 
                case WDIOC_GETSUPPORT:
                        if (copy_to_user(argp, &ident, sizeof ident))
index 2c7c9db..caec37b 100644 (file)
@@ -290,7 +290,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        switch(cmd)
        {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
                case WDIOC_GETSTATUS:
index c561299..fc0e034 100644 (file)
@@ -166,7 +166,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
 
        switch (cmd) {
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                if(copy_to_user(argp, &ident, sizeof(ident)))
                        return -EFAULT;
index e5b8c64..dc40362 100644 (file)
@@ -360,7 +360,7 @@ static int sh_wdt_ioctl(struct inode *inode, struct file *file,
 
                        return retval;
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 
        return 0;
index ef8da51..4067e1f 100644 (file)
@@ -203,7 +203,7 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
        };
        switch (cmd) {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &ident,
                                sizeof(ident)) ? -EFAULT : 0;
index 13f16d4..b4adc52 100644 (file)
@@ -223,7 +223,7 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        }
 
        default:
-         return -ENOIOCTLCMD;
+         return -ENOTTY;
        }
        return 0;
 }
index ccf6c09..b0e5f84 100644 (file)
@@ -252,7 +252,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        switch(cmd)
        {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
                case WDIOC_GETSTATUS:
index 98f4e17..2c8d5d8 100644 (file)
@@ -393,7 +393,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file,
        switch(cmd)
        {
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
 
        case WDIOC_GETSUPPORT:
                return copy_to_user(uarg.ident, &ident, sizeof(ident)) ? -EFAULT : 0;
index 2bb6a9d..163e028 100644 (file)
@@ -174,7 +174,7 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
        }
 
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
        return 0;
 }
index 5c38cdf..1d64e27 100644 (file)
@@ -385,7 +385,7 @@ wdrtas_ioctl(struct inode *inode, struct file *file,
                return put_user(wdrtas_interval, argp);
 
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        }
 }
 
index 70be81e..13f23f4 100644 (file)
@@ -341,7 +341,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        switch(cmd)
        {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
 
index 6555fb8..89a249e 100644 (file)
@@ -137,7 +137,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
               unsigned long arg)
 {
        unsigned int new_margin;
-       int ret = -ENOIOCTLCMD;
+       int ret = -ENOTTY;
 
        switch(cmd) {
        case WDIOC_GETSUPPORT:
index a0935bc..6253041 100644 (file)
@@ -361,7 +361,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
        switch(cmd)
        {
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
 
        case WDIOC_GETSUPPORT:
                return copy_to_user(uarg.ident, &ident,
index 5918ca2..74d8cf8 100644 (file)
@@ -386,7 +386,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
        switch(cmd)
        {
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
                case WDIOC_GETSUPPORT:
                        return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;