diff options
author | Guenter Roeck <linux@roeck-us.net> | 2017-12-24 16:04:13 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2018-01-21 06:56:36 -0500 |
commit | 5bbecc5d3454d1069baf061a2cf0f04d0f0b9e7f (patch) | |
tree | 2c888f01d136b63e3789289493960964275de201 | |
parent | fd8f9093a07306036cf63eda35e3357db3387d3a (diff) |
watchdog: sp5100_tco: Clean up function and variable names
Use more common function and variable names.
Use pdev instead of dev for platform device.
Use sp5100_tco_probe() instead of sp5100_tco_init() for the probe function.
Drop sp5100_tco_cleanup(); just move the code into sp5100_tco_remove().
Use sp5100_tco_init() instead of sp5100_tco_init_module() for the module
initialization function.
Use sp5100_tco_exit() instead of sp5100_tco_cleanup_module() for the module
exit function.
Use consistent defines for accessing the watchdog control register.
Cc: Zoltán Böszörményi <zboszor@pr.hu>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/sp5100_tco.c | 25 | ||||
-rw-r--r-- | drivers/watchdog/sp5100_tco.h | 5 |
2 files changed, 12 insertions, 18 deletions
diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index ff240e5be833..1123fad38fdf 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c | |||
@@ -421,8 +421,8 @@ static int sp5100_tco_setupdevice(struct device *dev) | |||
421 | * Save WatchDogFired status, because WatchDogFired flag is | 421 | * Save WatchDogFired status, because WatchDogFired flag is |
422 | * cleared here. | 422 | * cleared here. |
423 | */ | 423 | */ |
424 | tco_wdt_fired = val & SP5100_PM_WATCHDOG_FIRED; | 424 | tco_wdt_fired = val & SP5100_WDT_FIRED; |
425 | val &= ~SP5100_PM_WATCHDOG_ACTION_RESET; | 425 | val &= ~SP5100_WDT_ACTION_RESET; |
426 | writel(val, SP5100_WDT_CONTROL(tcobase)); | 426 | writel(val, SP5100_WDT_CONTROL(tcobase)); |
427 | 427 | ||
428 | /* Set a reasonable heartbeat before we stop the timer */ | 428 | /* Set a reasonable heartbeat before we stop the timer */ |
@@ -445,7 +445,7 @@ unreg_region: | |||
445 | return ret; | 445 | return ret; |
446 | } | 446 | } |
447 | 447 | ||
448 | static int sp5100_tco_init(struct platform_device *pdev) | 448 | static int sp5100_tco_probe(struct platform_device *pdev) |
449 | { | 449 | { |
450 | struct device *dev = &pdev->dev; | 450 | struct device *dev = &pdev->dev; |
451 | int ret; | 451 | int ret; |
@@ -492,7 +492,7 @@ exit: | |||
492 | return ret; | 492 | return ret; |
493 | } | 493 | } |
494 | 494 | ||
495 | static void sp5100_tco_cleanup(void) | 495 | static int sp5100_tco_remove(struct platform_device *pdev) |
496 | { | 496 | { |
497 | /* Stop the timer before we leave */ | 497 | /* Stop the timer before we leave */ |
498 | if (!nowayout) | 498 | if (!nowayout) |
@@ -502,22 +502,17 @@ static void sp5100_tco_cleanup(void) | |||
502 | misc_deregister(&sp5100_tco_miscdev); | 502 | misc_deregister(&sp5100_tco_miscdev); |
503 | iounmap(tcobase); | 503 | iounmap(tcobase); |
504 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 504 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
505 | } | ||
506 | 505 | ||
507 | static int sp5100_tco_remove(struct platform_device *dev) | ||
508 | { | ||
509 | if (tcobase) | ||
510 | sp5100_tco_cleanup(); | ||
511 | return 0; | 506 | return 0; |
512 | } | 507 | } |
513 | 508 | ||
514 | static void sp5100_tco_shutdown(struct platform_device *dev) | 509 | static void sp5100_tco_shutdown(struct platform_device *pdev) |
515 | { | 510 | { |
516 | tco_timer_stop(); | 511 | tco_timer_stop(); |
517 | } | 512 | } |
518 | 513 | ||
519 | static struct platform_driver sp5100_tco_driver = { | 514 | static struct platform_driver sp5100_tco_driver = { |
520 | .probe = sp5100_tco_init, | 515 | .probe = sp5100_tco_probe, |
521 | .remove = sp5100_tco_remove, | 516 | .remove = sp5100_tco_remove, |
522 | .shutdown = sp5100_tco_shutdown, | 517 | .shutdown = sp5100_tco_shutdown, |
523 | .driver = { | 518 | .driver = { |
@@ -544,7 +539,7 @@ static const struct pci_device_id sp5100_tco_pci_tbl[] = { | |||
544 | }; | 539 | }; |
545 | MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl); | 540 | MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl); |
546 | 541 | ||
547 | static int __init sp5100_tco_init_module(void) | 542 | static int __init sp5100_tco_init(void) |
548 | { | 543 | { |
549 | struct pci_dev *dev = NULL; | 544 | struct pci_dev *dev = NULL; |
550 | int err; | 545 | int err; |
@@ -580,14 +575,14 @@ unreg_platform_driver: | |||
580 | return err; | 575 | return err; |
581 | } | 576 | } |
582 | 577 | ||
583 | static void __exit sp5100_tco_cleanup_module(void) | 578 | static void __exit sp5100_tco_exit(void) |
584 | { | 579 | { |
585 | platform_device_unregister(sp5100_tco_platform_device); | 580 | platform_device_unregister(sp5100_tco_platform_device); |
586 | platform_driver_unregister(&sp5100_tco_driver); | 581 | platform_driver_unregister(&sp5100_tco_driver); |
587 | } | 582 | } |
588 | 583 | ||
589 | module_init(sp5100_tco_init_module); | 584 | module_init(sp5100_tco_init); |
590 | module_exit(sp5100_tco_cleanup_module); | 585 | module_exit(sp5100_tco_exit); |
591 | 586 | ||
592 | MODULE_AUTHOR("Priyanka Gupta"); | 587 | MODULE_AUTHOR("Priyanka Gupta"); |
593 | MODULE_DESCRIPTION("TCO timer driver for SP5100/SB800 chipset"); | 588 | MODULE_DESCRIPTION("TCO timer driver for SP5100/SB800 chipset"); |
diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h index 2622cfe23dc1..cc00f1157220 100644 --- a/drivers/watchdog/sp5100_tco.h +++ b/drivers/watchdog/sp5100_tco.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #define SP5100_WDT_COUNT(base) ((base) + 0x04) /* Watchdog Count */ | 15 | #define SP5100_WDT_COUNT(base) ((base) + 0x04) /* Watchdog Count */ |
16 | 16 | ||
17 | #define SP5100_WDT_START_STOP_BIT (1 << 0) | 17 | #define SP5100_WDT_START_STOP_BIT (1 << 0) |
18 | #define SP5100_WDT_FIRED (1 << 1) | ||
19 | #define SP5100_WDT_ACTION_RESET (1 << 2) | ||
18 | #define SP5100_WDT_TRIGGER_BIT (1 << 7) | 20 | #define SP5100_WDT_TRIGGER_BIT (1 << 7) |
19 | 21 | ||
20 | #define SP5100_PM_IOPORTS_SIZE 0x02 | 22 | #define SP5100_PM_IOPORTS_SIZE 0x02 |
@@ -34,9 +36,6 @@ | |||
34 | #define SP5100_PM_WATCHDOG_CONTROL 0x69 | 36 | #define SP5100_PM_WATCHDOG_CONTROL 0x69 |
35 | #define SP5100_PM_WATCHDOG_BASE 0x6C | 37 | #define SP5100_PM_WATCHDOG_BASE 0x6C |
36 | 38 | ||
37 | #define SP5100_PM_WATCHDOG_FIRED (1 << 1) | ||
38 | #define SP5100_PM_WATCHDOG_ACTION_RESET (1 << 2) | ||
39 | |||
40 | #define SP5100_PCI_WATCHDOG_MISC_REG 0x41 | 39 | #define SP5100_PCI_WATCHDOG_MISC_REG 0x41 |
41 | #define SP5100_PCI_WATCHDOG_DECODE_EN (1 << 3) | 40 | #define SP5100_PCI_WATCHDOG_DECODE_EN (1 << 3) |
42 | 41 | ||