aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2015-08-12 04:15:53 -0400
committerWim Van Sebroeck <wim@iguana.be>2015-09-09 15:36:39 -0400
commit50ffb53ef2311e4631086d27783b00db6859c60e (patch)
tree83f98b23fd810647db00b43d886b7cf6ca53191f /drivers/watchdog
parenta57e06f7c6365f7d6e13f35933d3ef329205c1af (diff)
watchdog: mpc8xxx: simplify registration
Since commit ef90174f8210 ("watchdog: watchdog_core: Add watchdog registration deferral mechanism") there is no need to delay the call to watchdog_register_device any more. So simplify the registration code accordingly. Resetting wd_base to NULL can the also be dropped because nothing depends on it being NULL to signal probe failure any more. (The matching wd_base = NULL in .remove was missing, too.) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 8ad42b83f995..e0acda3282d9 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -51,7 +51,6 @@ struct mpc8xxx_wdt_type {
51}; 51};
52 52
53static struct mpc8xxx_wdt __iomem *wd_base; 53static struct mpc8xxx_wdt __iomem *wd_base;
54static int mpc8xxx_wdt_init_late(void);
55 54
56static u16 timeout = 0xffff; 55static u16 timeout = 0xffff;
57module_param(timeout, ushort, 0); 56module_param(timeout, ushort, 0);
@@ -174,11 +173,14 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
174 timeout_sec = (timeout * wdt_type->prescaler) / freq; 173 timeout_sec = (timeout * wdt_type->prescaler) / freq;
175 174
176 mpc8xxx_wdt_dev.timeout = timeout_sec; 175 mpc8xxx_wdt_dev.timeout = timeout_sec;
177#ifdef MODULE 176
178 ret = mpc8xxx_wdt_init_late(); 177 watchdog_set_nowayout(&mpc8xxx_wdt_dev, nowayout);
179 if (ret) 178
179 ret = watchdog_register_device(&mpc8xxx_wdt_dev);
180 if (ret) {
181 pr_err("cannot register watchdog device (err=%d)\n", ret);
180 goto err_unmap; 182 goto err_unmap;
181#endif 183 }
182 184
183 pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d seconds)\n", 185 pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d seconds)\n",
184 reset ? "reset" : "interrupt", timeout, timeout_sec); 186 reset ? "reset" : "interrupt", timeout, timeout_sec);
@@ -193,7 +195,6 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
193 return 0; 195 return 0;
194err_unmap: 196err_unmap:
195 iounmap(wd_base); 197 iounmap(wd_base);
196 wd_base = NULL;
197 return ret; 198 return ret;
198} 199}
199 200
@@ -242,31 +243,6 @@ static struct platform_driver mpc8xxx_wdt_driver = {
242 }, 243 },
243}; 244};
244 245
245/*
246 * We do wdt initialization in two steps: arch_initcall probes the wdt
247 * very early to start pinging the watchdog (misc devices are not yet
248 * available), and later module_init() just registers the misc device.
249 */
250static int mpc8xxx_wdt_init_late(void)
251{
252 int ret;
253
254 if (!wd_base)
255 return -ENODEV;
256
257 watchdog_set_nowayout(&mpc8xxx_wdt_dev, nowayout);
258
259 ret = watchdog_register_device(&mpc8xxx_wdt_dev);
260 if (ret) {
261 pr_err("cannot register watchdog device (err=%d)\n", ret);
262 return ret;
263 }
264 return 0;
265}
266#ifndef MODULE
267module_init(mpc8xxx_wdt_init_late);
268#endif
269
270static int __init mpc8xxx_wdt_init(void) 246static int __init mpc8xxx_wdt_init(void)
271{ 247{
272 return platform_driver_register(&mpc8xxx_wdt_driver); 248 return platform_driver_register(&mpc8xxx_wdt_driver);