[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 c77fe3cf2852a198ff51133c0d79be03918a2960..154d67e591e5c928b6cd59b97a746e994c46b8d8 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 8069be445edc3683f358e644ec7e883d7d4ad40c..9d732769ba0144bd36a720d4362185dc0bb651d1 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 0b2c8e841c8684bfe226dfcf049452b6af248ee4..01b0d132ee41b3890b58cb3a983b87742bf69dff 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 383f9bf6810c3b8f35a90e3ac97f1217edd25321..5948863b592b7434d57117dadc381a7584c113be 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 cc266715ea320b029496d0b5ad1d3ece4dc0d77e..4e7a1145e78fd472a70f9442e3a0c7bec461741d 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 e3cefc538b40476b341aeed5e4f61a874b64baa4..488902231cc237ec24cd76568af57c186bc6d12d 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 04c7e49918db0b5d491521f63a2415d318f0443a..00bdabb90f27b958a76ab7b8d39c4b505892411e 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 77c8a955ae9e1f10f2e548b6b395bffe420d1f48..01cf123b1616db2eebda898dafbd167e994d8099 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 62dbccb2f6df979b23e0129871b6884df40b0c76..4f4269754c462fb21aa2573a23a1028323af98db 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 870539eabbf3a93100693f19f966b1e404104ce5..fb64df4d7c8720107f16e360047c93ef2deac0b4 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 3c6daca43a00987ae094cfb4769b3757f4fb4cd9..e0627d79707b27f6b91d8ccb47506a29f1fad451 100644 (file)
@@ -356,7 +356,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
                }
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index fd95f7327798692c8612da2caacd1939ba0b7280..c1ed209a138ca3176313abcf3fa4bdcc2de33b9f 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 26ceee7a4df0922bd370560a4023d1bfa1892267..dd6760f1a23ba43ecc40342cc9c1d9da3ef13e9c 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 dacc1c20a310747aa322f9661047d82d47e1c7ab..0bc239308989d53dbf7adf8ad537ada06e086b12 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 692908819e26651cda0aa04ad555a78a651b6a52..c91d9a660ec00c5644a6d5a0a386582209d5aecc 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 9db5cf2c38c37064334875b42c35c93dbce15126..db477f7123883c143cdabef88b456a8c6c400850 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 23734e07fb22503d5395550e49bae577595a1295..ed2b6e1e3cecfc0708e0ac77d62068a05d46bb44 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 ae943324d2511e2b5ab174b59d864fc055ca60a3..c2dac0aa1d6254906468a35dcbaea932197b416f 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 a480903ee1a59cbf4e17e0bcd150cc0e4aef47c6..18ca752e2f904f7425208c0fd2453ef0c55ebd99 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 35dd9e6e114023e5b9d65a801b23e8a728be1263..8aaed10dd4999e66928168cdb781df1fda97fad2 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 54b3c56ead0df8abdde728fe425a54ac9fc7661f..02d336ace50477bdb85609329cebb44f6422efdb 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 5c8fab345b403668a6159cc9b8a35392a0cc3b36..b887cdb0133428c07d4f08613b355527dad55b82 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 cd7d1b6a5d9fb2dd97aeae7783327f74163d8830..6f8515db5b076028cb620de63e01e8d3692be6f8 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 c7cfd6dbfe1b299b7bcf8db0189645cb3a5fe78d..2de6e497c1402e9fa434c1f7afd12708f1820427 100644 (file)
@@ -541,7 +541,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
                }
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index b7ae73dcdd0823602e1c75983fdb7455f9a7a824..77662cb0ac46e3962beb4f7d660ecaf16fc9bb4c 100644 (file)
@@ -445,7 +445,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
                }
 
                default:
-                       return -ENOIOCTLCMD;
+                       return -ENOTTY;
        }
 }
 
index a49f1f2ffa22a17003ac9055498efd257e26f909..b36a04ae9ab8e96306a35ce07680aed56bae40d2 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 1fc16d995788792794e7cbf3cb673c62314464d0..33c1137f17d6d3e8be5cbbc3abb2bf3099721cc1 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 4663c2fd53cd6fbe57f41c6acad6c2577cbc452b..c7b2045bc76b5196f6aa04c732c2dd95a4912704 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 bfc475dabe6d76406dd44b968479227c31678619..8882b427d24f44d988bd2682fee1559a305eecec 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 7c3cf293a5afc3684111c95bce7ad52653a4cb74..d8d0f28e0acf9ab30b54c9abfd57f12416313e7d 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 2c7c9db71be81e9eb5318cebe94d7fd215ecd8c3..caec37ba750a6810e7ea54abb6f73a6e72ef8e69 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 c561299a5537b483ab242399114bb9580c499930..fc0e0347f9d24b665711e21ca8d315567ea20e98 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 e5b8c64f1d65acf4ac67dfb8f77d5376d2ac974e..dc403629aeb3d79a4e112798fe4ababfd2751070 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 ef8da517545add27cabc43338cbf17d851170625..4067e1f8a36878c7fa6665175051231b2710542f 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 13f16d41c2fd33a1db8d68cd6b74b41038c2a103..b4adc527e687e8c7e43f047be489b0fbc13f0ddf 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 ccf6c0915945d8f517f124cbf989016f6c1b1ddf..b0e5f84d6bafdc24fb9c21742f35b3b0bcdcc965 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 98f4e17db70a478441bfa9d68e2d1d1a704df12a..2c8d5d8bd4e85303750274d1e9b2907b66c0bdad 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 2bb6a9d6ad2805dba0bb60093a31acf6d5fd7e1c..163e028ef9ed6cee052ee4aa643d8659e17e5bc8 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 5c38cdf41731201b7f37506e79cbadf6cfcd3438..1d64e277567dc487a3ab1f098afe0b38c227d5d4 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 70be81e39a61b3284cd86775ebcdc6fa0d9f54c3..13f23f4a223347393173a86d7c4eb17648f5097a 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 6555fb844f2342113a91ca7cec265403e25f628a..89a249e23fdee2b0377d3e5a04ade645ee7979bf 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 a0935bc775f8eb847d39ab4f32eacb8a7914ae47..6253041b235bb2ae0c1260e772f86b659bd799cb 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 5918ca2c9c35b6c5bbc9bbb2d4012ebab122b80a..74d8cf836e13aa91fb11885dbb5e769ac5f2f49b 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;