All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Radu Rendec <rrendec@arista.com>
Cc: Wim Van Sebroeck <wim@iguana.be>, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v3 3/4] watchdog: i6300esb: do not hardcode heartbeat limits
Date: Thu, 26 Oct 2017 18:04:36 -0700	[thread overview]
Message-ID: <2635372d-04d9-11e1-1164-aa1bd2d27941@roeck-us.net> (raw)
In-Reply-To: <20171026161016.3198-3-rrendec@arista.com>

On 10/26/2017 09:10 AM, Radu Rendec wrote:
> The minimum, maximum and default values for the watchdog heartbeat
> (timeout) were hardcoded in several places (including module parameter
> description and warning message for invalid module parameter value).
> 
> This patch adds macros for the aforementioned values and replaces all
> occurences of hardcoded values by these macros.
> 
> Signed-off-by: Radu Rendec <rrendec@arista.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/i6300esb.c | 20 ++++++++++++--------
>   1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
> index 147462f431de..4d92925cdc1e 100644
> --- a/drivers/watchdog/i6300esb.c
> +++ b/drivers/watchdog/i6300esb.c
> @@ -81,12 +81,16 @@ static int cards_found;
>   
>   /* module parameters */
>   /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */
> -#define WATCHDOG_HEARTBEAT 30
> +#define ESB_HEARTBEAT_MIN	1
> +#define ESB_HEARTBEAT_MAX	2046
> +#define ESB_HEARTBEAT_DEFAULT	30
> +#define ESB_HEARTBEAT_RANGE __MODULE_STRING(ESB_HEARTBEAT_MIN) \
> +	"<heartbeat<" __MODULE_STRING(ESB_HEARTBEAT_MAX)
>   static int heartbeat; /* in seconds */
>   module_param(heartbeat, int, 0);
>   MODULE_PARM_DESC(heartbeat,
> -		"Watchdog heartbeat in seconds. (1<heartbeat<2046, default="
> -				__MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
> +	"Watchdog heartbeat in seconds. (" ESB_HEARTBEAT_RANGE
> +	", default=" __MODULE_STRING(ESB_HEARTBEAT_DEFAULT) ")");
>   
>   static bool nowayout = WATCHDOG_NOWAYOUT;
>   module_param(nowayout, bool, 0);
> @@ -315,13 +319,13 @@ static int esb_probe(struct pci_dev *pdev,
>   	/* Initialize the watchdog and make sure it does not run */
>   	edev->wdd.info = &esb_info;
>   	edev->wdd.ops = &esb_ops;
> -	edev->wdd.min_timeout = 1;
> -	edev->wdd.max_timeout = 2 * 0x03ff;
> -	edev->wdd.timeout = WATCHDOG_HEARTBEAT;
> +	edev->wdd.min_timeout = ESB_HEARTBEAT_MIN;
> +	edev->wdd.max_timeout = ESB_HEARTBEAT_MAX;
> +	edev->wdd.timeout = ESB_HEARTBEAT_DEFAULT;
>   	if (watchdog_init_timeout(&edev->wdd, heartbeat, NULL))
>   		dev_info(&pdev->dev,
> -			"heartbeat value must be 1<heartbeat<2046, using %u\n",
> -			edev->wdd.timeout);
> +			"heartbeat value must be " ESB_HEARTBEAT_RANGE
> +			", using %u\n", edev->wdd.timeout);
>   	watchdog_set_nowayout(&edev->wdd, nowayout);
>   	watchdog_stop_on_reboot(&edev->wdd);
>   	watchdog_stop_on_unregister(&edev->wdd);
> 


  reply	other threads:[~2017-10-27  1:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 18:25 [PATCH 1/3] watchdog: i6300esb: use the watchdog subsystem Radu Rendec
2017-10-16 18:25 ` [PATCH 2/3] watchdog: i6300esb: support multiple devices Radu Rendec
2017-10-22 17:05   ` [2/3] " Guenter Roeck
2017-10-16 18:25 ` [PATCH 3/3] watchdog: i6300esb: do not hardcode heartbeat limits Radu Rendec
2017-10-22 17:09   ` [3/3] " Guenter Roeck
2017-10-25 15:39     ` [PATCH v2 1/4] watchdog: i6300esb: use the watchdog subsystem Radu Rendec
2017-10-25 20:51       ` Guenter Roeck
2017-10-25 15:39     ` [PATCH v2 2/4] watchdog: i6300esb: support multiple devices Radu Rendec
2017-10-25 20:55       ` Guenter Roeck
2017-10-26 11:35         ` Radu Rendec
2017-10-26 13:51           ` Guenter Roeck
2017-10-26 16:10             ` [PATCH v3 1/4] watchdog: i6300esb: use the watchdog subsystem Radu Rendec
2017-10-27  1:03               ` Guenter Roeck
2017-10-26 16:10             ` [PATCH v3 2/4] watchdog: i6300esb: support multiple devices Radu Rendec
2017-10-27  1:02               ` Guenter Roeck
2017-10-27  1:04               ` Guenter Roeck
2017-10-26 16:10             ` [PATCH v3 3/4] watchdog: i6300esb: do not hardcode heartbeat limits Radu Rendec
2017-10-27  1:04               ` Guenter Roeck [this message]
2017-10-26 16:10             ` [PATCH v3 4/4] watchdog: i6300esb: remove info message and version number Radu Rendec
2017-10-27  1:05               ` Guenter Roeck
2017-10-27 10:58                 ` Radu Rendec
2017-10-25 15:39     ` [PATCH v2 3/4] watchdog: i6300esb: do not hardcode heartbeat limits Radu Rendec
2017-10-25 20:56       ` Guenter Roeck
2017-10-25 15:39     ` [PATCH v2 4/4] watchdog: i6300esb: bump version to 0.6 Radu Rendec
2017-10-25 20:57       ` Guenter Roeck
2017-10-22 17:02 ` [1/3] watchdog: i6300esb: use the watchdog subsystem 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=2635372d-04d9-11e1-1164-aa1bd2d27941@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=rrendec@arista.com \
    --cc=wim@iguana.be \
    /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.