hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/watchdog/cpwd.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* cpwd.c - driver implementation for hardware watchdog
23 * timers found on Sun Microsystems CP1400 and CP1500 boards.
34 *
....@@ -25,6 +26,7 @@
2526 #include <linux/interrupt.h>
2627 #include <linux/ioport.h>
2728 #include <linux/timer.h>
29
+#include <linux/compat.h>
2830 #include <linux/slab.h>
2931 #include <linux/mutex.h>
3032 #include <linux/io.h>
....@@ -394,7 +396,7 @@
394396
395397 mutex_unlock(&cpwd_mutex);
396398
397
- return nonseekable_open(inode, f);
399
+ return stream_open(inode, f);
398400 }
399401
400402 static int cpwd_release(struct inode *inode, struct file *file)
....@@ -472,27 +474,9 @@
472474 return 0;
473475 }
474476
475
-static long cpwd_compat_ioctl(struct file *file, unsigned int cmd,
476
- unsigned long arg)
477
+static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
477478 {
478
- int rval = -ENOIOCTLCMD;
479
-
480
- switch (cmd) {
481
- /* solaris ioctls are specific to this driver */
482
- case WIOCSTART:
483
- case WIOCSTOP:
484
- case WIOCGSTAT:
485
- mutex_lock(&cpwd_mutex);
486
- rval = cpwd_ioctl(file, cmd, arg);
487
- mutex_unlock(&cpwd_mutex);
488
- break;
489
-
490
- /* everything else is handled by the generic compat layer */
491
- default:
492
- break;
493
- }
494
-
495
- return rval;
479
+ return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
496480 }
497481
498482 static ssize_t cpwd_write(struct file *file, const char __user *buf,
....@@ -570,6 +554,8 @@
570554 if (str_prop)
571555 p->timeout = simple_strtoul(str_prop, NULL, 10);
572556
557
+ of_node_put(options);
558
+
573559 /* CP1400s seem to have broken PLD implementations-- the
574560 * interrupt_mask register cannot be written, so no timer
575561 * interrupts can be masked within the PLD.