Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'linux-watchdog-6.10-rc1' of git://www.linux-watchdog.org/linux-watchdog

Pull watchdog updates from Wim Van Sebroeck:

- Add Lenovo SE10 platform Watchdog Driver

- Other small fixes and improvements

* tag 'linux-watchdog-6.10-rc1' of git://www.linux-watchdog.org/linux-watchdog:
watchdog: LENOVO_SE10_WDT should depend on X86 && DMI
watchdog: sa1100: Fix PTR_ERR_OR_ZERO() vs NULL check in sa1100dog_probe()
watchdog: rti_wdt: Set min_hw_heartbeat_ms to accommodate a safety margin
watchdog: add HAS_IOPORT dependencies
watchdog/wdt-main: Use cpumask_of() to avoid cpumask var on stack
watchdog: bd9576: Drop "always-running" property
watchdog: mtx-1: drop driver owner assignment
watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger
watchdog: lenovo_se10_wdt: Watchdog driver for Lenovo SE10 platform

+370 -68
+41 -28
drivers/watchdog/Kconfig
··· 254 254 arch_initcall. 255 255 If in doubt, say N. 256 256 257 + config LENOVO_SE10_WDT 258 + tristate "Lenovo SE10 Watchdog" 259 + depends on (X86 && DMI) || COMPILE_TEST 260 + select WATCHDOG_CORE 261 + help 262 + If you say yes here you get support for the watchdog 263 + functionality for the Lenovo SE10 platform. 264 + 265 + This driver can also be built as a module. If so, the module 266 + will be called lenovo-se10-wdt. 267 + 257 268 config MENF21BMC_WATCHDOG 258 269 tristate "MEN 14F021P00 BMC Watchdog" 259 270 depends on MFD_MENF21BMC || COMPILE_TEST ··· 493 482 config 977_WATCHDOG 494 483 tristate "NetWinder WB83C977 watchdog" 495 484 depends on (FOOTBRIDGE && ARCH_NETWINDER) || (ARM && COMPILE_TEST) 485 + depends on HAS_IOPORT 496 486 help 497 487 Say Y here to include support for the WB977 watchdog included in 498 488 NetWinder machines. Alternatively say M to compile the driver as ··· 1087 1075 1088 1076 config ADVANTECH_WDT 1089 1077 tristate "Advantech SBC Watchdog Timer" 1090 - depends on X86 || COMPILE_TEST 1078 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1091 1079 help 1092 1080 If you are configuring a Linux kernel for the Advantech single-board 1093 1081 computer, say `Y' here to support its built-in watchdog timer ··· 1096 1084 1097 1085 config ADVANTECH_EC_WDT 1098 1086 tristate "Advantech Embedded Controller Watchdog Timer" 1099 - depends on X86 || COMPILE_TEST 1087 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1100 1088 select ISA_BUS_API 1101 1089 select WATCHDOG_CORE 1102 1090 help ··· 1129 1117 1130 1118 config EBC_C384_WDT 1131 1119 tristate "WinSystems EBC-C384 Watchdog Timer" 1132 - depends on X86 || COMPILE_TEST 1120 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1133 1121 select ISA_BUS_API 1134 1122 select WATCHDOG_CORE 1135 1123 help ··· 1139 1127 1140 1128 config EXAR_WDT 1141 1129 tristate "Exar Watchdog Timer" 1142 - depends on X86 || COMPILE_TEST 1130 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1143 1131 select WATCHDOG_CORE 1144 1132 help 1145 1133 Enables watchdog timer support for the watchdog timer present ··· 1150 1138 1151 1139 config F71808E_WDT 1152 1140 tristate "Fintek F718xx, F818xx Super I/O Watchdog" 1153 - depends on X86 || COMPILE_TEST 1141 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1154 1142 select WATCHDOG_CORE 1155 1143 help 1156 1144 This is the driver for the hardware watchdog on the Fintek F71808E, ··· 1162 1150 1163 1151 config SP5100_TCO 1164 1152 tristate "AMD/ATI SP5100 TCO Timer/Watchdog" 1165 - depends on (X86 || COMPILE_TEST) && PCI 1153 + depends on (X86 || COMPILE_TEST) && PCI && HAS_IOPORT 1166 1154 select WATCHDOG_CORE 1167 1155 help 1168 1156 Hardware watchdog driver for the AMD/ATI SP5100 chipset. The TCO ··· 1201 1189 1202 1190 config SBC_FITPC2_WATCHDOG 1203 1191 tristate "Compulab SBC-FITPC2 watchdog" 1204 - depends on X86 || COMPILE_TEST 1192 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1205 1193 help 1206 1194 This is the driver for the built-in watchdog timer on the fit-PC2, 1207 1195 fit-PC2i, CM-iAM single-board computers made by Compulab. ··· 1226 1214 1227 1215 config EUROTECH_WDT 1228 1216 tristate "Eurotech CPU-1220/1410 Watchdog Timer" 1229 - depends on X86 || COMPILE_TEST 1217 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1230 1218 help 1231 1219 Enable support for the watchdog timer on the Eurotech CPU-1220 and 1232 1220 CPU-1410 cards. These are PC/104 SBCs. Spec sheets and product ··· 1234 1222 1235 1223 config IB700_WDT 1236 1224 tristate "IB700 SBC Watchdog Timer" 1237 - depends on X86 || COMPILE_TEST 1225 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1238 1226 help 1239 1227 This is the driver for the hardware watchdog on the IB700 Single 1240 1228 Board Computer produced by TMC Technology (www.tmc-uk.com). This ··· 1251 1239 1252 1240 config IBMASR 1253 1241 tristate "IBM Automatic Server Restart" 1254 - depends on X86 || COMPILE_TEST 1242 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1255 1243 help 1256 1244 This is the driver for the IBM Automatic Server Restart watchdog 1257 1245 timer built-in into some eServer xSeries machines. ··· 1261 1249 1262 1250 config WAFER_WDT 1263 1251 tristate "ICP Single Board Computer Watchdog Timer" 1264 - depends on X86 || COMPILE_TEST 1252 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1265 1253 help 1266 1254 This is a driver for the hardware watchdog on the ICP Single 1267 1255 Board Computer. This driver is working on (at least) the following ··· 1283 1271 1284 1272 config IE6XX_WDT 1285 1273 tristate "Intel Atom E6xx Watchdog" 1286 - depends on (X86 || COMPILE_TEST) && PCI 1274 + depends on (X86 || COMPILE_TEST) && PCI && HAS_IOPORT 1287 1275 select WATCHDOG_CORE 1288 1276 select MFD_CORE 1289 1277 select LPC_SCH ··· 1313 1301 select WATCHDOG_CORE 1314 1302 depends on I2C || I2C=n 1315 1303 depends on MFD_INTEL_PMC_BXT || !MFD_INTEL_PMC_BXT 1304 + depends on HAS_IOPORT # for I2C_I801 1316 1305 select LPC_ICH if !EXPERT 1317 1306 select I2C_I801 if !EXPERT && I2C 1318 1307 help ··· 1344 1331 1345 1332 config IT8712F_WDT 1346 1333 tristate "IT8712F (Smart Guardian) Watchdog Timer" 1347 - depends on X86 || COMPILE_TEST 1334 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1348 1335 help 1349 1336 This is the driver for the built-in watchdog timer on the IT8712F 1350 1337 Super I/0 chipset used on many motherboards. ··· 1357 1344 1358 1345 config IT87_WDT 1359 1346 tristate "IT87 Watchdog Timer" 1360 - depends on X86 || COMPILE_TEST 1347 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1361 1348 select WATCHDOG_CORE 1362 1349 help 1363 1350 This is the driver for the hardware watchdog on the ITE IT8607, ··· 1405 1392 1406 1393 config SC1200_WDT 1407 1394 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" 1408 - depends on X86 || COMPILE_TEST 1395 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1409 1396 help 1410 1397 This is a driver for National Semiconductor PC87307/PC97307 hardware 1411 1398 watchdog cards as found on the SC1200. This watchdog is mainly used ··· 1428 1415 1429 1416 config PC87413_WDT 1430 1417 tristate "NS PC87413 watchdog" 1431 - depends on X86 || COMPILE_TEST 1418 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1432 1419 help 1433 1420 This is the driver for the hardware watchdog on the PC87413 chipset 1434 1421 This watchdog simply watches your kernel to make sure it doesn't ··· 1442 1429 1443 1430 config NV_TCO 1444 1431 tristate "nVidia TCO Timer/Watchdog" 1445 - depends on (X86 || COMPILE_TEST) && PCI 1432 + depends on (X86 || COMPILE_TEST) && PCI && HAS_IOPORT 1446 1433 help 1447 1434 Hardware driver for the TCO timer built into the nVidia Hub family 1448 1435 (such as the MCP51). The TCO (Total Cost of Ownership) timer is a ··· 1471 1458 1472 1459 config 60XX_WDT 1473 1460 tristate "SBC-60XX Watchdog Timer" 1474 - depends on X86 || COMPILE_TEST 1461 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1475 1462 help 1476 1463 This driver can be used with the watchdog timer found on some 1477 1464 single board computers, namely the 6010 PII based computer. ··· 1511 1498 1512 1499 config CPU5_WDT 1513 1500 tristate "SMA CPU5 Watchdog" 1514 - depends on X86 || COMPILE_TEST 1501 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1515 1502 help 1516 1503 TBD. 1517 1504 To compile this driver as a module, choose M here: the ··· 1519 1506 1520 1507 config SMSC_SCH311X_WDT 1521 1508 tristate "SMSC SCH311X Watchdog Timer" 1522 - depends on X86 || COMPILE_TEST 1509 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1523 1510 help 1524 1511 This is the driver for the hardware watchdog timer on the 1525 1512 SMSC SCH3112, SCH3114 and SCH3116 Super IO chipset ··· 1531 1518 1532 1519 config SMSC37B787_WDT 1533 1520 tristate "Winbond SMsC37B787 Watchdog Timer" 1534 - depends on X86 || COMPILE_TEST 1521 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1535 1522 help 1536 1523 This is the driver for the hardware watchdog component on the 1537 1524 Winbond SMsC37B787 chipset as used on the NetRunner Mainboard ··· 1577 1564 1578 1565 config W83627HF_WDT 1579 1566 tristate "Watchdog timer for W83627HF/W83627DHG and compatibles" 1580 - depends on X86 || COMPILE_TEST 1567 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1581 1568 select WATCHDOG_CORE 1582 1569 help 1583 1570 This is the driver for the hardware watchdog on the following ··· 1607 1594 1608 1595 config W83877F_WDT 1609 1596 tristate "W83877F (EMACS) Watchdog Timer" 1610 - depends on X86 || COMPILE_TEST 1597 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1611 1598 help 1612 1599 This is the driver for the hardware watchdog on the W83877F chipset 1613 1600 as used in EMACS PC-104 motherboards (and likely others). This ··· 1622 1609 1623 1610 config W83977F_WDT 1624 1611 tristate "W83977F (PCM-5335) Watchdog Timer" 1625 - depends on X86 || COMPILE_TEST 1612 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1626 1613 help 1627 1614 This is the driver for the hardware watchdog on the W83977F I/O chip 1628 1615 as used in AAEON's PCM-5335 SBC (and likely others). This ··· 1635 1622 1636 1623 config MACHZ_WDT 1637 1624 tristate "ZF MachZ Watchdog" 1638 - depends on X86 || COMPILE_TEST 1625 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1639 1626 help 1640 1627 If you are using a ZF Micro MachZ processor, say Y here, otherwise 1641 1628 N. This is the driver for the watchdog timer built-in on that ··· 1648 1635 1649 1636 config SBC_EPX_C3_WATCHDOG 1650 1637 tristate "Winsystems SBC EPX-C3 watchdog" 1651 - depends on X86 || COMPILE_TEST 1638 + depends on (X86 || COMPILE_TEST) && HAS_IOPORT 1652 1639 help 1653 1640 This is the driver for the built-in watchdog timer on the EPX-C3 1654 1641 Single-board computer made by Winsystems, Inc. ··· 2210 2197 2211 2198 config PCIPCWATCHDOG 2212 2199 tristate "Berkshire Products PCI-PC Watchdog" 2213 - depends on PCI 2200 + depends on PCI && HAS_IOPORT 2214 2201 help 2215 2202 This is the driver for the Berkshire Products PCI-PC Watchdog card. 2216 2203 This card simply watches your kernel to make sure it doesn't freeze, ··· 2225 2212 2226 2213 config WDTPCI 2227 2214 tristate "PCI-WDT500/501 Watchdog timer" 2228 - depends on PCI 2215 + depends on PCI && HAS_IOPORT 2229 2216 help 2230 2217 If you have a PCI-WDT500/501 watchdog board, say Y here, otherwise N. 2231 2218
+1
drivers/watchdog/Makefile
··· 120 120 obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o 121 121 obj-$(CONFIG_IE6XX_WDT) += ie6xx_wdt.o 122 122 obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o 123 + obj-$(CONFIG_LENOVO_SE10_WDT) += lenovo_se10_wdt.o 123 124 ifeq ($(CONFIG_ITCO_VENDOR_SUPPORT),y) 124 125 obj-$(CONFIG_ITCO_WDT) += iTCO_vendor_support.o 125 126 endif
+1 -11
drivers/watchdog/bd9576_wdt.c
··· 29 29 struct gpio_desc *gpiod_en; 30 30 struct device *dev; 31 31 struct regmap *regmap; 32 - bool always_running; 33 32 struct watchdog_device wdd; 34 33 }; 35 34 ··· 61 62 { 62 63 struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd); 63 64 64 - if (!priv->always_running) 65 - bd9576_wdt_disable(priv); 66 - else 67 - set_bit(WDOG_HW_RUNNING, &wdd->status); 65 + bd9576_wdt_disable(priv); 68 66 69 67 return 0; 70 68 } ··· 260 264 if (ret) 261 265 return ret; 262 266 263 - priv->always_running = device_property_read_bool(dev->parent, 264 - "always-running"); 265 - 266 267 watchdog_set_drvdata(&priv->wdd, priv); 267 268 268 269 priv->wdd.info = &bd957x_wdt_ident; ··· 273 280 watchdog_set_nowayout(&priv->wdd, nowayout); 274 281 275 282 watchdog_stop_on_reboot(&priv->wdd); 276 - 277 - if (priv->always_running) 278 - bd9576_wdt_start(&priv->wdd); 279 283 280 284 return devm_watchdog_register_device(dev, &priv->wdd); 281 285 }
+1 -1
drivers/watchdog/cpu5wdt.c
··· 252 252 if (cpu5wdt_device.queue) { 253 253 cpu5wdt_device.queue = 0; 254 254 wait_for_completion(&cpu5wdt_device.stop); 255 - del_timer(&cpu5wdt_device.timer); 255 + timer_shutdown_sync(&cpu5wdt_device.timer); 256 256 } 257 257 258 258 misc_deregister(&cpu5wdt_misc);
+308
drivers/watchdog/lenovo_se10_wdt.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * WDT driver for Lenovo SE10. 4 + */ 5 + 6 + #include <linux/delay.h> 7 + #include <linux/dmi.h> 8 + #include <linux/io.h> 9 + #include <linux/module.h> 10 + #include <linux/moduleparam.h> 11 + #include <linux/platform_device.h> 12 + #include <linux/string.h> 13 + #include <linux/types.h> 14 + #include <linux/watchdog.h> 15 + 16 + #define STATUS_PORT 0x6C 17 + #define CMD_PORT 0x6C 18 + #define DATA_PORT 0x68 19 + #define OUTBUF_FULL 0x01 20 + #define INBUF_EMPTY 0x02 21 + #define CFG_LDN 0x07 22 + #define CFG_BRAM_LDN 0x10 /* for BRAM Base */ 23 + #define CFG_PORT 0x2E 24 + #define CFG_SIZE 2 25 + #define CMD_SIZE 4 26 + #define BRAM_SIZE 2 27 + 28 + #define UNLOCK_KEY 0x87 29 + #define LOCK_KEY 0xAA 30 + 31 + #define CUS_WDT_SWI 0x1A 32 + #define CUS_WDT_CFG 0x1B 33 + #define CUS_WDT_FEED 0xB0 34 + #define CUS_WDT_CNT 0xB1 35 + 36 + #define DRVNAME "lenovo-se10-wdt" 37 + 38 + /*The timeout range is 1-255 seconds*/ 39 + #define MIN_TIMEOUT 1 40 + #define MAX_TIMEOUT 255 41 + #define MAX_WAIT 10 42 + 43 + #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ 44 + static unsigned short bram_base; 45 + static struct platform_device *se10_pdev; 46 + 47 + static int timeout; /* in seconds */ 48 + module_param(timeout, int, 0); 49 + MODULE_PARM_DESC(timeout, 50 + "Watchdog timeout in seconds. 1 <= timeout <= 255, default=" 51 + __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 52 + 53 + static bool nowayout = WATCHDOG_NOWAYOUT; 54 + module_param(nowayout, bool, 0); 55 + MODULE_PARM_DESC(nowayout, 56 + "Watchdog cannot be stopped once started (default=" 57 + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 58 + 59 + struct se10_wdt { 60 + struct watchdog_device wdd; 61 + }; 62 + 63 + static int set_bram(unsigned char offset, unsigned char val) 64 + { 65 + if (!request_muxed_region(bram_base, BRAM_SIZE, DRVNAME)) 66 + return -EBUSY; 67 + outb(offset, bram_base); 68 + outb(val, bram_base + 1); 69 + release_region(bram_base, BRAM_SIZE); 70 + return 0; 71 + } 72 + 73 + static void wait_for_buffer(int condition) 74 + { 75 + int loop = 0; 76 + 77 + while (1) { 78 + if (inb(STATUS_PORT) & condition || loop > MAX_WAIT) 79 + break; 80 + loop++; 81 + usleep_range(10, 125); 82 + } 83 + } 84 + 85 + static void send_cmd(unsigned char cmd) 86 + { 87 + wait_for_buffer(INBUF_EMPTY); 88 + outb(cmd, CMD_PORT); 89 + wait_for_buffer(INBUF_EMPTY); 90 + } 91 + 92 + static void lpc_write(unsigned char index, unsigned char data) 93 + { 94 + outb(index, CFG_PORT); 95 + outb(data, CFG_PORT + 1); 96 + } 97 + 98 + static unsigned char lpc_read(unsigned char index) 99 + { 100 + outb(index, CFG_PORT); 101 + return inb(CFG_PORT + 1); 102 + } 103 + 104 + static int wdt_start(struct watchdog_device *wdog) 105 + { 106 + return set_bram(CUS_WDT_SWI, 0x80); 107 + } 108 + 109 + static int wdt_set_timeout(struct watchdog_device *wdog, unsigned int timeout) 110 + { 111 + wdog->timeout = timeout; 112 + return set_bram(CUS_WDT_CFG, wdog->timeout); 113 + } 114 + 115 + static int wdt_stop(struct watchdog_device *wdog) 116 + { 117 + return set_bram(CUS_WDT_SWI, 0); 118 + } 119 + 120 + static unsigned int wdt_get_time(struct watchdog_device *wdog) 121 + { 122 + unsigned char time; 123 + 124 + if (!request_muxed_region(CMD_PORT, CMD_SIZE, DRVNAME)) 125 + return -EBUSY; 126 + send_cmd(CUS_WDT_CNT); 127 + wait_for_buffer(OUTBUF_FULL); 128 + time = inb(DATA_PORT); 129 + release_region(CMD_PORT, CMD_SIZE); 130 + return time; 131 + } 132 + 133 + static int wdt_ping(struct watchdog_device *wdog) 134 + { 135 + if (!request_muxed_region(CMD_PORT, CMD_SIZE, DRVNAME)) 136 + return -EBUSY; 137 + send_cmd(CUS_WDT_FEED); 138 + release_region(CMD_PORT, CMD_SIZE); 139 + return 0; 140 + } 141 + 142 + static const struct watchdog_info wdt_info = { 143 + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, 144 + .identity = "Lenovo SE10 Watchdog", 145 + }; 146 + 147 + static const struct watchdog_ops se10_wdt_ops = { 148 + .owner = THIS_MODULE, 149 + .start = wdt_start, 150 + .stop = wdt_stop, 151 + .ping = wdt_ping, 152 + .set_timeout = wdt_set_timeout, 153 + .get_timeleft = wdt_get_time, 154 + }; 155 + 156 + static unsigned int get_chipID(void) 157 + { 158 + unsigned char msb, lsb; 159 + 160 + outb(UNLOCK_KEY, CFG_PORT); 161 + outb(0x01, CFG_PORT); 162 + outb(0x55, CFG_PORT); 163 + outb(0x55, CFG_PORT); 164 + msb = lpc_read(0x20); 165 + lsb = lpc_read(0x21); 166 + outb(LOCK_KEY, CFG_PORT); 167 + return (msb * 256 + lsb); 168 + } 169 + 170 + static int se10_wdt_probe(struct platform_device *pdev) 171 + { 172 + struct device *dev = &pdev->dev; 173 + struct se10_wdt *priv; 174 + unsigned int chip_id; 175 + int ret; 176 + 177 + if (!request_muxed_region(CFG_PORT, CFG_SIZE, DRVNAME)) 178 + return -EBUSY; 179 + 180 + chip_id = get_chipID(); 181 + if (chip_id != 0x5632) { 182 + release_region(CFG_PORT, CFG_SIZE); 183 + return -ENODEV; 184 + } 185 + 186 + lpc_write(CFG_LDN, CFG_BRAM_LDN); 187 + bram_base = (lpc_read(0x60) << 8) | lpc_read(0x61); 188 + release_region(CFG_PORT, CFG_SIZE); 189 + 190 + dev_info(dev, "Found Lenovo SE10 0x%x\n", chip_id); 191 + 192 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 193 + if (!priv) 194 + return -ENOMEM; 195 + 196 + watchdog_set_drvdata(&priv->wdd, priv); 197 + 198 + priv->wdd.parent = dev; 199 + priv->wdd.info = &wdt_info, 200 + priv->wdd.ops = &se10_wdt_ops, 201 + priv->wdd.timeout = WATCHDOG_TIMEOUT; /* Set default timeout */ 202 + priv->wdd.min_timeout = MIN_TIMEOUT; 203 + priv->wdd.max_timeout = MAX_TIMEOUT; 204 + 205 + set_bram(CUS_WDT_CFG, WATCHDOG_TIMEOUT); /* Set time to default */ 206 + 207 + watchdog_init_timeout(&priv->wdd, timeout, dev); 208 + watchdog_set_nowayout(&priv->wdd, nowayout); 209 + watchdog_stop_on_reboot(&priv->wdd); 210 + watchdog_stop_on_unregister(&priv->wdd); 211 + 212 + ret = devm_watchdog_register_device(dev, &priv->wdd); 213 + 214 + dev_dbg(&pdev->dev, "initialized. timeout=%d sec (nowayout=%d)\n", 215 + priv->wdd.timeout, nowayout); 216 + 217 + return ret; 218 + } 219 + 220 + static struct platform_driver se10_wdt_driver = { 221 + .driver = { 222 + .name = DRVNAME, 223 + }, 224 + .probe = se10_wdt_probe, 225 + }; 226 + 227 + static int se10_create_platform_device(const struct dmi_system_id *id) 228 + { 229 + int err; 230 + 231 + se10_pdev = platform_device_alloc("lenovo-se10-wdt", -1); 232 + if (!se10_pdev) 233 + return -ENOMEM; 234 + 235 + err = platform_device_add(se10_pdev); 236 + if (err) 237 + platform_device_put(se10_pdev); 238 + 239 + return err; 240 + } 241 + 242 + static const struct dmi_system_id se10_dmi_table[] __initconst = { 243 + { 244 + .ident = "LENOVO-SE10", 245 + .matches = { 246 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 247 + DMI_MATCH(DMI_PRODUCT_NAME, "12NH"), 248 + }, 249 + .callback = se10_create_platform_device, 250 + }, 251 + { 252 + .ident = "LENOVO-SE10", 253 + .matches = { 254 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 255 + DMI_MATCH(DMI_PRODUCT_NAME, "12NJ"), 256 + }, 257 + .callback = se10_create_platform_device, 258 + }, 259 + { 260 + .ident = "LENOVO-SE10", 261 + .matches = { 262 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 263 + DMI_MATCH(DMI_PRODUCT_NAME, "12NK"), 264 + }, 265 + .callback = se10_create_platform_device, 266 + }, 267 + { 268 + .ident = "LENOVO-SE10", 269 + .matches = { 270 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 271 + DMI_MATCH(DMI_PRODUCT_NAME, "12NL"), 272 + }, 273 + .callback = se10_create_platform_device, 274 + }, 275 + { 276 + .ident = "LENOVO-SE10", 277 + .matches = { 278 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 279 + DMI_MATCH(DMI_PRODUCT_NAME, "12NM"), 280 + }, 281 + .callback = se10_create_platform_device, 282 + }, 283 + {} 284 + }; 285 + MODULE_DEVICE_TABLE(dmi, se10_dmi_table); 286 + 287 + static int __init se10_wdt_init(void) 288 + { 289 + if (!dmi_check_system(se10_dmi_table)) 290 + return -ENODEV; 291 + 292 + return platform_driver_register(&se10_wdt_driver); 293 + } 294 + 295 + static void __exit se10_wdt_exit(void) 296 + { 297 + if (se10_pdev) 298 + platform_device_unregister(se10_pdev); 299 + platform_driver_unregister(&se10_wdt_driver); 300 + } 301 + 302 + module_init(se10_wdt_init); 303 + module_exit(se10_wdt_exit); 304 + 305 + MODULE_LICENSE("GPL"); 306 + MODULE_AUTHOR("David Ober<dober@lenovo.com>"); 307 + MODULE_AUTHOR("Mark Pearson <mpearson-lenovo@squebb.ca>"); 308 + MODULE_DESCRIPTION("WDT driver for Lenovo SE10");
-1
drivers/watchdog/mtx-1_wdt.c
··· 236 236 .probe = mtx1_wdt_probe, 237 237 .remove_new = mtx1_wdt_remove, 238 238 .driver.name = "mtx1-wdt", 239 - .driver.owner = THIS_MODULE, 240 239 }; 241 240 242 241 module_platform_driver(mtx1_wdt_driver);
+1 -5
drivers/watchdog/octeon-wdt-main.c
··· 381 381 382 382 /* Must set the irq affinity here */ 383 383 if (octeon_has_feature(OCTEON_FEATURE_CIU3)) { 384 - cpumask_t mask; 385 - 386 - cpumask_clear(&mask); 387 - cpumask_set_cpu(cpu, &mask); 388 - irq_set_affinity(irq, &mask); 384 + irq_set_affinity(irq, cpumask_of(cpu)); 389 385 } 390 386 391 387 cpumask_set_cpu(cpu, &irq_enabled_cpus);
+15 -19
drivers/watchdog/rti_wdt.c
··· 59 59 #define PON_REASON_EOF_NUM 0xCCCCBBBB 60 60 #define RESERVED_MEM_MIN_SIZE 12 61 61 62 + #define MAX_HW_ERROR 250 63 + 62 64 static int heartbeat = DEFAULT_HEARTBEAT; 63 65 64 66 /* ··· 99 97 * to be 50% or less than that; we obviouly want to configure the open 100 98 * window as large as possible so we select the 50% option. 101 99 */ 102 - wdd->min_hw_heartbeat_ms = 500 * wdd->timeout; 100 + wdd->min_hw_heartbeat_ms = 520 * wdd->timeout + MAX_HW_ERROR; 103 101 104 102 /* Generate NMI when wdt expires */ 105 103 writel_relaxed(RTIWWDRX_NMI, wdt->base + RTIWWDRXCTRL); ··· 133 131 * be petted during the open window; not too early or not too late. 134 132 * The HW configuration options only allow for the open window size 135 133 * to be 50% or less than that. 134 + * To avoid any glitches, we accommodate 2% + max hardware error 135 + * safety margin. 136 136 */ 137 137 switch (wsize) { 138 138 case RTIWWDSIZE_50P: 139 - /* 50% open window => 50% min heartbeat */ 140 - wdd->min_hw_heartbeat_ms = 500 * heartbeat; 139 + /* 50% open window => 52% min heartbeat */ 140 + wdd->min_hw_heartbeat_ms = 520 * heartbeat + MAX_HW_ERROR; 141 141 break; 142 142 143 143 case RTIWWDSIZE_25P: 144 - /* 25% open window => 75% min heartbeat */ 145 - wdd->min_hw_heartbeat_ms = 750 * heartbeat; 144 + /* 25% open window => 77% min heartbeat */ 145 + wdd->min_hw_heartbeat_ms = 770 * heartbeat + MAX_HW_ERROR; 146 146 break; 147 147 148 148 case RTIWWDSIZE_12P5: 149 - /* 12.5% open window => 87.5% min heartbeat */ 150 - wdd->min_hw_heartbeat_ms = 875 * heartbeat; 149 + /* 12.5% open window => 89.5% min heartbeat */ 150 + wdd->min_hw_heartbeat_ms = 895 * heartbeat + MAX_HW_ERROR; 151 151 break; 152 152 153 153 case RTIWWDSIZE_6P25: 154 - /* 6.5% open window => 93.5% min heartbeat */ 155 - wdd->min_hw_heartbeat_ms = 935 * heartbeat; 154 + /* 6.5% open window => 95.5% min heartbeat */ 155 + wdd->min_hw_heartbeat_ms = 955 * heartbeat + MAX_HW_ERROR; 156 156 break; 157 157 158 158 case RTIWWDSIZE_3P125: 159 - /* 3.125% open window => 96.9% min heartbeat */ 160 - wdd->min_hw_heartbeat_ms = 969 * heartbeat; 159 + /* 3.125% open window => 98.9% min heartbeat */ 160 + wdd->min_hw_heartbeat_ms = 989 * heartbeat + MAX_HW_ERROR; 161 161 break; 162 162 163 163 default: ··· 236 232 dev_err(dev, "Failed to get fck rate.\n"); 237 233 return -EINVAL; 238 234 } 239 - 240 - /* 241 - * If watchdog is running at 32k clock, it is not accurate. 242 - * Adjust frequency down in this case so that we don't pet 243 - * the watchdog too often. 244 - */ 245 - if (wdt->freq < 32768) 246 - wdt->freq = wdt->freq * 9 / 10; 247 235 248 236 pm_runtime_enable(dev); 249 237 ret = pm_runtime_resume_and_get(dev);
+2 -3
drivers/watchdog/sa1100_wdt.c
··· 191 191 if (!res) 192 192 return -ENXIO; 193 193 reg_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 194 - ret = PTR_ERR_OR_ZERO(reg_base); 195 - if (ret) 196 - return ret; 194 + if (!reg_base) 195 + return -ENOMEM; 197 196 198 197 clk = clk_get(NULL, "OSTIMER0"); 199 198 if (IS_ERR(clk)) {