hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/watchdog/ixp4xx_wdt.c
....@@ -21,6 +21,7 @@
2121 #include <linux/kernel.h>
2222 #include <linux/fs.h>
2323 #include <linux/miscdevice.h>
24
+#include <linux/of.h>
2425 #include <linux/watchdog.h>
2526 #include <linux/init.h>
2627 #include <linux/bitops.h>
....@@ -65,7 +66,7 @@
6566
6667 clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
6768 wdt_enable();
68
- return nonseekable_open(inode, file);
69
+ return stream_open(inode, file);
6970 }
7071
7172 static ssize_t
....@@ -135,7 +136,7 @@
135136
136137 heartbeat = time;
137138 wdt_enable();
138
- /* Fall through */
139
+ fallthrough;
139140
140141 case WDIOC_GETTIMEOUT:
141142 ret = put_user(heartbeat, (int *)arg);
....@@ -162,6 +163,7 @@
162163 .llseek = no_llseek,
163164 .write = ixp4xx_wdt_write,
164165 .unlocked_ioctl = ixp4xx_wdt_ioctl,
166
+ .compat_ioctl = compat_ptr_ioctl,
165167 .open = ixp4xx_wdt_open,
166168 .release = ixp4xx_wdt_release,
167169 };
....@@ -176,6 +178,14 @@
176178 {
177179 int ret;
178180
181
+ /*
182
+ * FIXME: we bail out on device tree boot but this really needs
183
+ * to be fixed in a nicer way: this registers the MDIO bus before
184
+ * even matching the driver infrastructure, we should only probe
185
+ * detected hardware.
186
+ */
187
+ if (of_have_populated_dt())
188
+ return -ENODEV;
179189 if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) {
180190 pr_err("Rev. A0 IXP42x CPU detected - watchdog disabled\n");
181191