diff options
author | Steven J. Hill <Steven.Hill@cavium.com> | 2017-08-29 11:40:36 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-09-04 15:19:03 -0400 |
commit | 381cec022e46f51268f3e33c9c60764fb56f73df (patch) | |
tree | 0e45e5ecb8e61e8f4a42e026eeacd854cfacc566 /drivers/watchdog | |
parent | ba1fc93457e3506aaab88b67b5404a8915ea8233 (diff) |
watchdog: octeon-wdt: File cleaning.
* Update copyright and company name.
* Remove unused headers.
* Fix variable spelling and data type.
* Use octal values for module parameters.
Signed-off-by: Steven J. Hill <steven.hill@cavium.com>
Acked-by: David Daney <david.daney@cavium.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: linux-mips@linux-mips.org
Cc: linux-watchdog@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/17212/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/octeon-wdt-main.c | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c index fbdd48404b54..73b510231169 100644 --- a/drivers/watchdog/octeon-wdt-main.c +++ b/drivers/watchdog/octeon-wdt-main.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Octeon Watchdog driver | 2 | * Octeon Watchdog driver |
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008, 2009, 2010 Cavium Networks | 4 | * Copyright (C) 2007-2017 Cavium, Inc. |
5 | * | 5 | * |
6 | * Converted to use WATCHDOG_CORE by Aaro Koskinen <aaro.koskinen@iki.fi>. | 6 | * Converted to use WATCHDOG_CORE by Aaro Koskinen <aaro.koskinen@iki.fi>. |
7 | * | 7 | * |
@@ -59,14 +59,9 @@ | |||
59 | #include <linux/interrupt.h> | 59 | #include <linux/interrupt.h> |
60 | #include <linux/watchdog.h> | 60 | #include <linux/watchdog.h> |
61 | #include <linux/cpumask.h> | 61 | #include <linux/cpumask.h> |
62 | #include <linux/bitops.h> | ||
63 | #include <linux/kernel.h> | ||
64 | #include <linux/module.h> | 62 | #include <linux/module.h> |
65 | #include <linux/string.h> | ||
66 | #include <linux/delay.h> | 63 | #include <linux/delay.h> |
67 | #include <linux/cpu.h> | 64 | #include <linux/cpu.h> |
68 | #include <linux/smp.h> | ||
69 | #include <linux/fs.h> | ||
70 | #include <linux/irq.h> | 65 | #include <linux/irq.h> |
71 | 66 | ||
72 | #include <asm/mipsregs.h> | 67 | #include <asm/mipsregs.h> |
@@ -85,7 +80,7 @@ static unsigned int max_timeout_sec; | |||
85 | static unsigned int timeout_sec; | 80 | static unsigned int timeout_sec; |
86 | 81 | ||
87 | /* Set to non-zero when userspace countdown mode active */ | 82 | /* Set to non-zero when userspace countdown mode active */ |
88 | static int do_coundown; | 83 | static bool do_countdown; |
89 | static unsigned int countdown_reset; | 84 | static unsigned int countdown_reset; |
90 | static unsigned int per_cpu_countdown[NR_CPUS]; | 85 | static unsigned int per_cpu_countdown[NR_CPUS]; |
91 | 86 | ||
@@ -94,17 +89,22 @@ static cpumask_t irq_enabled_cpus; | |||
94 | #define WD_TIMO 60 /* Default heartbeat = 60 seconds */ | 89 | #define WD_TIMO 60 /* Default heartbeat = 60 seconds */ |
95 | 90 | ||
96 | static int heartbeat = WD_TIMO; | 91 | static int heartbeat = WD_TIMO; |
97 | module_param(heartbeat, int, S_IRUGO); | 92 | module_param(heartbeat, int, 0444); |
98 | MODULE_PARM_DESC(heartbeat, | 93 | MODULE_PARM_DESC(heartbeat, |
99 | "Watchdog heartbeat in seconds. (0 < heartbeat, default=" | 94 | "Watchdog heartbeat in seconds. (0 < heartbeat, default=" |
100 | __MODULE_STRING(WD_TIMO) ")"); | 95 | __MODULE_STRING(WD_TIMO) ")"); |
101 | 96 | ||
102 | static bool nowayout = WATCHDOG_NOWAYOUT; | 97 | static bool nowayout = WATCHDOG_NOWAYOUT; |
103 | module_param(nowayout, bool, S_IRUGO); | 98 | module_param(nowayout, bool, 0444); |
104 | MODULE_PARM_DESC(nowayout, | 99 | MODULE_PARM_DESC(nowayout, |
105 | "Watchdog cannot be stopped once started (default=" | 100 | "Watchdog cannot be stopped once started (default=" |
106 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 101 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
107 | 102 | ||
103 | static int disable; | ||
104 | module_param(disable, int, 0444); | ||
105 | MODULE_PARM_DESC(disable, | ||
106 | "Disable the watchdog entirely (default=0)"); | ||
107 | |||
108 | static struct cvmx_boot_vector_element *octeon_wdt_bootvector; | 108 | static struct cvmx_boot_vector_element *octeon_wdt_bootvector; |
109 | 109 | ||
110 | void octeon_wdt_nmi_stage2(void); | 110 | void octeon_wdt_nmi_stage2(void); |
@@ -140,7 +140,7 @@ static irqreturn_t octeon_wdt_poke_irq(int cpl, void *dev_id) | |||
140 | unsigned int core = cvmx_get_core_num(); | 140 | unsigned int core = cvmx_get_core_num(); |
141 | int cpu = core2cpu(core); | 141 | int cpu = core2cpu(core); |
142 | 142 | ||
143 | if (do_coundown) { | 143 | if (do_countdown) { |
144 | if (per_cpu_countdown[cpu] > 0) { | 144 | if (per_cpu_countdown[cpu] > 0) { |
145 | /* We're alive, poke the watchdog */ | 145 | /* We're alive, poke the watchdog */ |
146 | cvmx_write_csr(CVMX_CIU_PP_POKEX(core), 1); | 146 | cvmx_write_csr(CVMX_CIU_PP_POKEX(core), 1); |
@@ -324,11 +324,14 @@ static int octeon_wdt_ping(struct watchdog_device __always_unused *wdog) | |||
324 | int cpu; | 324 | int cpu; |
325 | int coreid; | 325 | int coreid; |
326 | 326 | ||
327 | if (disable) | ||
328 | return 0; | ||
329 | |||
327 | for_each_online_cpu(cpu) { | 330 | for_each_online_cpu(cpu) { |
328 | coreid = cpu2core(cpu); | 331 | coreid = cpu2core(cpu); |
329 | cvmx_write_csr(CVMX_CIU_PP_POKEX(coreid), 1); | 332 | cvmx_write_csr(CVMX_CIU_PP_POKEX(coreid), 1); |
330 | per_cpu_countdown[cpu] = countdown_reset; | 333 | per_cpu_countdown[cpu] = countdown_reset; |
331 | if ((countdown_reset || !do_coundown) && | 334 | if ((countdown_reset || !do_countdown) && |
332 | !cpumask_test_cpu(cpu, &irq_enabled_cpus)) { | 335 | !cpumask_test_cpu(cpu, &irq_enabled_cpus)) { |
333 | /* We have to enable the irq */ | 336 | /* We have to enable the irq */ |
334 | int irq = OCTEON_IRQ_WDOG0 + coreid; | 337 | int irq = OCTEON_IRQ_WDOG0 + coreid; |
@@ -378,6 +381,9 @@ static int octeon_wdt_set_timeout(struct watchdog_device *wdog, | |||
378 | 381 | ||
379 | octeon_wdt_calc_parameters(t); | 382 | octeon_wdt_calc_parameters(t); |
380 | 383 | ||
384 | if (disable) | ||
385 | return 0; | ||
386 | |||
381 | for_each_online_cpu(cpu) { | 387 | for_each_online_cpu(cpu) { |
382 | coreid = cpu2core(cpu); | 388 | coreid = cpu2core(cpu); |
383 | cvmx_write_csr(CVMX_CIU_PP_POKEX(coreid), 1); | 389 | cvmx_write_csr(CVMX_CIU_PP_POKEX(coreid), 1); |
@@ -394,13 +400,13 @@ static int octeon_wdt_set_timeout(struct watchdog_device *wdog, | |||
394 | static int octeon_wdt_start(struct watchdog_device *wdog) | 400 | static int octeon_wdt_start(struct watchdog_device *wdog) |
395 | { | 401 | { |
396 | octeon_wdt_ping(wdog); | 402 | octeon_wdt_ping(wdog); |
397 | do_coundown = 1; | 403 | do_countdown = 1; |
398 | return 0; | 404 | return 0; |
399 | } | 405 | } |
400 | 406 | ||
401 | static int octeon_wdt_stop(struct watchdog_device *wdog) | 407 | static int octeon_wdt_stop(struct watchdog_device *wdog) |
402 | { | 408 | { |
403 | do_coundown = 0; | 409 | do_countdown = 0; |
404 | octeon_wdt_ping(wdog); | 410 | octeon_wdt_ping(wdog); |
405 | return 0; | 411 | return 0; |
406 | } | 412 | } |
@@ -473,6 +479,11 @@ static int __init octeon_wdt_init(void) | |||
473 | return ret; | 479 | return ret; |
474 | } | 480 | } |
475 | 481 | ||
482 | if (disable) { | ||
483 | pr_notice("disabled\n"); | ||
484 | return 0; | ||
485 | } | ||
486 | |||
476 | cpumask_clear(&irq_enabled_cpus); | 487 | cpumask_clear(&irq_enabled_cpus); |
477 | 488 | ||
478 | ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "watchdog/octeon:online", | 489 | ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "watchdog/octeon:online", |
@@ -493,6 +504,10 @@ err: | |||
493 | static void __exit octeon_wdt_cleanup(void) | 504 | static void __exit octeon_wdt_cleanup(void) |
494 | { | 505 | { |
495 | watchdog_unregister_device(&octeon_wdt); | 506 | watchdog_unregister_device(&octeon_wdt); |
507 | |||
508 | if (disable) | ||
509 | return; | ||
510 | |||
496 | cpuhp_remove_state(octeon_wdt_online); | 511 | cpuhp_remove_state(octeon_wdt_online); |
497 | 512 | ||
498 | /* | 513 | /* |
@@ -503,7 +518,7 @@ static void __exit octeon_wdt_cleanup(void) | |||
503 | } | 518 | } |
504 | 519 | ||
505 | MODULE_LICENSE("GPL"); | 520 | MODULE_LICENSE("GPL"); |
506 | MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>"); | 521 | MODULE_AUTHOR("Cavium Inc. <support@cavium.com>"); |
507 | MODULE_DESCRIPTION("Cavium Networks Octeon Watchdog driver."); | 522 | MODULE_DESCRIPTION("Cavium Inc. OCTEON Watchdog driver."); |
508 | module_init(octeon_wdt_init); | 523 | module_init(octeon_wdt_init); |
509 | module_exit(octeon_wdt_cleanup); | 524 | module_exit(octeon_wdt_cleanup); |