summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-08-14 16:42:32 -0400
committerWim Van Sebroeck <wim@linux-watchdog.org>2019-09-17 02:59:02 -0400
commit68f28b01fb9e5fc3ec273104714bd71bac783845 (patch)
tree764fd7eb0631892e28b40a0e8db816f5339667d4
parent31bfa64e9428c2ab6608377fb3d4c40e29c7f4ce (diff)
watchdog: cpwd: use generic compat_ptr_ioctl
The cpwd_compat_ioctl() contains a bogus mutex that dates back to a leftover BKL instance. Simplify the implementation by using the new compat_ptr_ioctl() helper function that will do the right thing for all calls here. Note that WIOCSTART/WIOCSTOP don't take any arguments, so the compat_ptr() conversion is not needed here, but it also doesn't hurt. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20190814204259.120942-6-arnd@arndb.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
-rw-r--r--drivers/watchdog/cpwd.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index b973b31179df..9393be584e72 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -473,29 +473,6 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
473 return 0; 473 return 0;
474} 474}
475 475
476static long cpwd_compat_ioctl(struct file *file, unsigned int cmd,
477 unsigned long arg)
478{
479 int rval = -ENOIOCTLCMD;
480
481 switch (cmd) {
482 /* solaris ioctls are specific to this driver */
483 case WIOCSTART:
484 case WIOCSTOP:
485 case WIOCGSTAT:
486 mutex_lock(&cpwd_mutex);
487 rval = cpwd_ioctl(file, cmd, arg);
488 mutex_unlock(&cpwd_mutex);
489 break;
490
491 /* everything else is handled by the generic compat layer */
492 default:
493 break;
494 }
495
496 return rval;
497}
498
499static ssize_t cpwd_write(struct file *file, const char __user *buf, 476static ssize_t cpwd_write(struct file *file, const char __user *buf,
500 size_t count, loff_t *ppos) 477 size_t count, loff_t *ppos)
501{ 478{
@@ -520,7 +497,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer,
520static const struct file_operations cpwd_fops = { 497static const struct file_operations cpwd_fops = {
521 .owner = THIS_MODULE, 498 .owner = THIS_MODULE,
522 .unlocked_ioctl = cpwd_ioctl, 499 .unlocked_ioctl = cpwd_ioctl,
523 .compat_ioctl = cpwd_compat_ioctl, 500 .compat_ioctl = compat_ptr_ioctl,
524 .open = cpwd_open, 501 .open = cpwd_open,
525 .write = cpwd_write, 502 .write = cpwd_write,
526 .read = cpwd_read, 503 .read = cpwd_read,