Commit e6c3b699b2f6fcba7036c079b6f16bf9556c7f0d
1 parent
c54fb81174
Exists in
master
and in
7 other branches
watchdog: bcm63xx_wdt: improve platform part.
* fix devinit and devexit sections * fix platform removal code so that the iounmap happens after the removal of the timer. * changes the reboot_notifier by a platform shutdown method. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Showing 1 changed file with 12 additions and 30 deletions Side-by-side Diff
drivers/watchdog/bcm63xx_wdt.c
... | ... | @@ -18,7 +18,6 @@ |
18 | 18 | #include <linux/miscdevice.h> |
19 | 19 | #include <linux/module.h> |
20 | 20 | #include <linux/moduleparam.h> |
21 | -#include <linux/reboot.h> | |
22 | 21 | #include <linux/types.h> |
23 | 22 | #include <linux/uaccess.h> |
24 | 23 | #include <linux/watchdog.h> |
... | ... | @@ -220,14 +219,6 @@ |
220 | 219 | } |
221 | 220 | } |
222 | 221 | |
223 | -static int bcm63xx_wdt_notify_sys(struct notifier_block *this, | |
224 | - unsigned long code, void *unused) | |
225 | -{ | |
226 | - if (code == SYS_DOWN || code == SYS_HALT) | |
227 | - bcm63xx_wdt_pause(); | |
228 | - return NOTIFY_DONE; | |
229 | -} | |
230 | - | |
231 | 222 | static const struct file_operations bcm63xx_wdt_fops = { |
232 | 223 | .owner = THIS_MODULE, |
233 | 224 | .llseek = no_llseek, |
234 | 225 | |
... | ... | @@ -243,12 +234,8 @@ |
243 | 234 | .fops = &bcm63xx_wdt_fops, |
244 | 235 | }; |
245 | 236 | |
246 | -static struct notifier_block bcm63xx_wdt_notifier = { | |
247 | - .notifier_call = bcm63xx_wdt_notify_sys, | |
248 | -}; | |
249 | 237 | |
250 | - | |
251 | -static int bcm63xx_wdt_probe(struct platform_device *pdev) | |
238 | +static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev) | |
252 | 239 | { |
253 | 240 | int ret; |
254 | 241 | struct resource *r; |
255 | 242 | |
... | ... | @@ -280,16 +267,10 @@ |
280 | 267 | wdt_time); |
281 | 268 | } |
282 | 269 | |
283 | - ret = register_reboot_notifier(&bcm63xx_wdt_notifier); | |
284 | - if (ret) { | |
285 | - dev_err(&pdev->dev, "failed to register reboot_notifier\n"); | |
286 | - goto unregister_timer; | |
287 | - } | |
288 | - | |
289 | 270 | ret = misc_register(&bcm63xx_wdt_miscdev); |
290 | 271 | if (ret < 0) { |
291 | 272 | dev_err(&pdev->dev, "failed to register watchdog device\n"); |
292 | - goto unregister_reboot_notifier; | |
273 | + goto unregister_timer; | |
293 | 274 | } |
294 | 275 | |
295 | 276 | dev_info(&pdev->dev, " started, timer margin: %d sec\n", |
... | ... | @@ -297,8 +278,6 @@ |
297 | 278 | |
298 | 279 | return 0; |
299 | 280 | |
300 | -unregister_reboot_notifier: | |
301 | - unregister_reboot_notifier(&bcm63xx_wdt_notifier); | |
302 | 281 | unregister_timer: |
303 | 282 | bcm63xx_timer_unregister(TIMER_WDT_ID); |
304 | 283 | unmap: |
305 | 284 | |
306 | 285 | |
307 | 286 | |
308 | 287 | |
309 | 288 | |
... | ... | @@ -306,25 +285,28 @@ |
306 | 285 | return ret; |
307 | 286 | } |
308 | 287 | |
309 | -static int bcm63xx_wdt_remove(struct platform_device *pdev) | |
288 | +static int __devexit bcm63xx_wdt_remove(struct platform_device *pdev) | |
310 | 289 | { |
311 | 290 | if (!nowayout) |
312 | 291 | bcm63xx_wdt_pause(); |
313 | 292 | |
314 | 293 | misc_deregister(&bcm63xx_wdt_miscdev); |
315 | - | |
316 | - iounmap(bcm63xx_wdt_device.regs); | |
317 | - | |
318 | - unregister_reboot_notifier(&bcm63xx_wdt_notifier); | |
319 | 294 | bcm63xx_timer_unregister(TIMER_WDT_ID); |
320 | - | |
295 | + iounmap(bcm63xx_wdt_device.regs); | |
321 | 296 | return 0; |
322 | 297 | } |
323 | 298 | |
299 | +static void bcm63xx_wdt_shutdown(struct platform_device *pdev) | |
300 | +{ | |
301 | + bcm63xx_wdt_pause(); | |
302 | +} | |
303 | + | |
324 | 304 | static struct platform_driver bcm63xx_wdt = { |
325 | 305 | .probe = bcm63xx_wdt_probe, |
326 | - .remove = bcm63xx_wdt_remove, | |
306 | + .remove = __devexit_p(bcm63xx_wdt_remove), | |
307 | + .shutdown = bcm63xx_wdt_shutdown, | |
327 | 308 | .driver = { |
309 | + .owner = THIS_MODULE, | |
328 | 310 | .name = "bcm63xx-wdt", |
329 | 311 | } |
330 | 312 | }; |