All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Steven J. Hill" <steven.hill@cavium.com>
Cc: linux-mips@linux-mips.org, linux-watchdog@vger.kernel.org,
	ralf@linux-mips.org
Subject: Re: [PATCH 6/8] watchdog: octeon-wdt: File cleaning.
Date: Tue, 29 Aug 2017 21:33:49 -0700	[thread overview]
Message-ID: <20170830043349.GB14791@roeck-us.net> (raw)
In-Reply-To: <1504021238-3184-7-git-send-email-steven.hill@cavium.com>

On Tue, Aug 29, 2017 at 10:40:36AM -0500, Steven J. Hill wrote:
> From: "Steven J. Hill" <Steven.Hill@cavium.com>
> 
> * 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>

> ---
>  drivers/watchdog/octeon-wdt-main.c | 45 +++++++++++++++++++++++++-------------
>  1 file changed, 30 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c
> index fbdd484..73b5102 100644
> --- a/drivers/watchdog/octeon-wdt-main.c
> +++ b/drivers/watchdog/octeon-wdt-main.c
> @@ -1,7 +1,7 @@
>  /*
>   * Octeon Watchdog driver
>   *
> - * Copyright (C) 2007, 2008, 2009, 2010 Cavium Networks
> + * Copyright (C) 2007-2017 Cavium, Inc.
>   *
>   * Converted to use WATCHDOG_CORE by Aaro Koskinen <aaro.koskinen@iki.fi>.
>   *
> @@ -59,14 +59,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/watchdog.h>
>  #include <linux/cpumask.h>
> -#include <linux/bitops.h>
> -#include <linux/kernel.h>
>  #include <linux/module.h>
> -#include <linux/string.h>
>  #include <linux/delay.h>
>  #include <linux/cpu.h>
> -#include <linux/smp.h>
> -#include <linux/fs.h>
>  #include <linux/irq.h>
>  
>  #include <asm/mipsregs.h>
> @@ -85,7 +80,7 @@ static unsigned int max_timeout_sec;
>  static unsigned int timeout_sec;
>  
>  /* Set to non-zero when userspace countdown mode active */
> -static int do_coundown;
> +static bool do_countdown;
>  static unsigned int countdown_reset;
>  static unsigned int per_cpu_countdown[NR_CPUS];
>  
> @@ -94,17 +89,22 @@ static cpumask_t irq_enabled_cpus;
>  #define WD_TIMO 60			/* Default heartbeat = 60 seconds */
>  
>  static int heartbeat = WD_TIMO;
> -module_param(heartbeat, int, S_IRUGO);
> +module_param(heartbeat, int, 0444);
>  MODULE_PARM_DESC(heartbeat,
>  	"Watchdog heartbeat in seconds. (0 < heartbeat, default="
>  				__MODULE_STRING(WD_TIMO) ")");
>  
>  static bool nowayout = WATCHDOG_NOWAYOUT;
> -module_param(nowayout, bool, S_IRUGO);
> +module_param(nowayout, bool, 0444);
>  MODULE_PARM_DESC(nowayout,
>  	"Watchdog cannot be stopped once started (default="
>  				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>  
> +static int disable;
> +module_param(disable, int, 0444);
> +MODULE_PARM_DESC(disable,
> +	"Disable the watchdog entirely (default=0)");
> +
>  static struct cvmx_boot_vector_element *octeon_wdt_bootvector;
>  
>  void octeon_wdt_nmi_stage2(void);
> @@ -140,7 +140,7 @@ static irqreturn_t octeon_wdt_poke_irq(int cpl, void *dev_id)
>  	unsigned int core = cvmx_get_core_num();
>  	int cpu = core2cpu(core);
>  
> -	if (do_coundown) {
> +	if (do_countdown) {
>  		if (per_cpu_countdown[cpu] > 0) {
>  			/* We're alive, poke the watchdog */
>  			cvmx_write_csr(CVMX_CIU_PP_POKEX(core), 1);
> @@ -324,11 +324,14 @@ static int octeon_wdt_ping(struct watchdog_device __always_unused *wdog)
>  	int cpu;
>  	int coreid;
>  
> +	if (disable)
> +		return 0;
> +
>  	for_each_online_cpu(cpu) {
>  		coreid = cpu2core(cpu);
>  		cvmx_write_csr(CVMX_CIU_PP_POKEX(coreid), 1);
>  		per_cpu_countdown[cpu] = countdown_reset;
> -		if ((countdown_reset || !do_coundown) &&
> +		if ((countdown_reset || !do_countdown) &&
>  		    !cpumask_test_cpu(cpu, &irq_enabled_cpus)) {
>  			/* We have to enable the irq */
>  			int irq = OCTEON_IRQ_WDOG0 + coreid;
> @@ -378,6 +381,9 @@ static int octeon_wdt_set_timeout(struct watchdog_device *wdog,
>  
>  	octeon_wdt_calc_parameters(t);
>  
> +	if (disable)
> +		return 0;
> +
>  	for_each_online_cpu(cpu) {
>  		coreid = cpu2core(cpu);
>  		cvmx_write_csr(CVMX_CIU_PP_POKEX(coreid), 1);
> @@ -394,13 +400,13 @@ static int octeon_wdt_set_timeout(struct watchdog_device *wdog,
>  static int octeon_wdt_start(struct watchdog_device *wdog)
>  {
>  	octeon_wdt_ping(wdog);
> -	do_coundown = 1;
> +	do_countdown = 1;
>  	return 0;
>  }
>  
>  static int octeon_wdt_stop(struct watchdog_device *wdog)
>  {
> -	do_coundown = 0;
> +	do_countdown = 0;
>  	octeon_wdt_ping(wdog);
>  	return 0;
>  }
> @@ -473,6 +479,11 @@ static int __init octeon_wdt_init(void)
>  		return ret;
>  	}
>  
> +	if (disable) {
> +		pr_notice("disabled\n");
> +		return 0;
> +	}
> +
>  	cpumask_clear(&irq_enabled_cpus);
>  
>  	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "watchdog/octeon:online",
> @@ -493,6 +504,10 @@ static int __init octeon_wdt_init(void)
>  static void __exit octeon_wdt_cleanup(void)
>  {
>  	watchdog_unregister_device(&octeon_wdt);
> +
> +	if (disable)
> +		return;
> +
>  	cpuhp_remove_state(octeon_wdt_online);
>  
>  	/*
> @@ -503,7 +518,7 @@ static void __exit octeon_wdt_cleanup(void)
>  }
>  
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
> -MODULE_DESCRIPTION("Cavium Networks Octeon Watchdog driver.");
> +MODULE_AUTHOR("Cavium Inc. <support@cavium.com>");
> +MODULE_DESCRIPTION("Cavium Inc. OCTEON Watchdog driver.");
>  module_init(octeon_wdt_init);
>  module_exit(octeon_wdt_cleanup);
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-08-30  4:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 15:40 [PATCH 0/8] Update Octeon watchdog driver Steven J. Hill
2017-08-29 15:40 ` [PATCH 1/8] MIPS: Octeon: Add support for accessing the boot vector Steven J. Hill
2017-08-29 15:40 ` [PATCH 2/8] watchdog: octeon-wdt: Remove old boot vector code Steven J. Hill
2017-08-30  4:33   ` Guenter Roeck
2017-08-30 14:16     ` Steven J. Hill
2017-08-29 15:40 ` [PATCH 3/8] MIPS: Octeon: Watchdog registers for 70xx, 73xx, 78xx, F75xx Steven J. Hill
2017-08-29 15:40 ` [PATCH 4/8] MIPS: Octeon: Make CSR functions node aware Steven J. Hill
2017-08-29 15:40 ` [PATCH 5/8] MIPS: Octeon: Allow access to CIU3 IRQ domains Steven J. Hill
2017-08-29 15:40 ` [PATCH 6/8] watchdog: octeon-wdt: File cleaning Steven J. Hill
2017-08-30  4:33   ` Guenter Roeck [this message]
2017-08-29 15:40 ` [PATCH 7/8] watchdog: octeon-wdt: Add support for cn68XX SOCs Steven J. Hill
2017-08-30  4:34   ` Guenter Roeck
2017-08-29 15:40 ` [PATCH 8/8] watchdog: octeon-wdt: Add support for 78XX SOCs Steven J. Hill
2017-08-30  4:34   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170830043349.GB14791@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=steven.hill@cavium.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.