* [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback
@ 2022-07-26 8:56 Pali Rohár
2022-07-26 13:33 ` Guenter Roeck
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pali Rohár @ 2022-07-26 8:56 UTC (permalink / raw)
To: Marek Behún, Wim Van Sebroeck, Guenter Roeck
Cc: linux-watchdog, linux-kernel
ioctl(WDIOC_SETTIMEOUT) calls .set_timeout and .ping callbacks and it is
expected that it changes current watchdog timeout.
armada_37xx_wdt's .ping callback just reping counter 0 and does not touch
counter 1 used for timeout. So it is needed to set counter 1 to the new
value in .set_timeout callback to ensure ioctl(WDIOC_SETTIMEOUT)
functionality. Fix it.
Fixes: 54e3d9b518c8 ("watchdog: Add support for Armada 37xx CPU watchdog")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
drivers/watchdog/armada_37xx_wdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c
index 1635f421ef2c..b84cba94b135 100644
--- a/drivers/watchdog/armada_37xx_wdt.c
+++ b/drivers/watchdog/armada_37xx_wdt.c
@@ -179,6 +179,8 @@ static int armada_37xx_wdt_set_timeout(struct watchdog_device *wdt,
dev->timeout = (u64)dev->clk_rate * timeout;
do_div(dev->timeout, CNTR_CTRL_PRESCALE_MIN);
+ set_counter_value(dev, CNTR_ID_WDOG, dev->timeout);
+
return 0;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback
2022-07-26 8:56 [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback Pali Rohár
@ 2022-07-26 13:33 ` Guenter Roeck
2022-07-26 13:45 ` Marek Behún
2022-09-24 10:51 ` Pali Rohár
2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-07-26 13:33 UTC (permalink / raw)
To: Pali Rohár, Marek Behún, Wim Van Sebroeck
Cc: linux-watchdog, linux-kernel
On 7/26/22 01:56, Pali Rohár wrote:
> ioctl(WDIOC_SETTIMEOUT) calls .set_timeout and .ping callbacks and it is
> expected that it changes current watchdog timeout.
>
> armada_37xx_wdt's .ping callback just reping counter 0 and does not touch
> counter 1 used for timeout. So it is needed to set counter 1 to the new
> value in .set_timeout callback to ensure ioctl(WDIOC_SETTIMEOUT)
> functionality. Fix it.
>
> Fixes: 54e3d9b518c8 ("watchdog: Add support for Armada 37xx CPU watchdog")
> Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/armada_37xx_wdt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c
> index 1635f421ef2c..b84cba94b135 100644
> --- a/drivers/watchdog/armada_37xx_wdt.c
> +++ b/drivers/watchdog/armada_37xx_wdt.c
> @@ -179,6 +179,8 @@ static int armada_37xx_wdt_set_timeout(struct watchdog_device *wdt,
> dev->timeout = (u64)dev->clk_rate * timeout;
> do_div(dev->timeout, CNTR_CTRL_PRESCALE_MIN);
>
> + set_counter_value(dev, CNTR_ID_WDOG, dev->timeout);
> +
> return 0;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback
2022-07-26 8:56 [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback Pali Rohár
2022-07-26 13:33 ` Guenter Roeck
@ 2022-07-26 13:45 ` Marek Behún
2022-09-24 10:51 ` Pali Rohár
2 siblings, 0 replies; 4+ messages in thread
From: Marek Behún @ 2022-07-26 13:45 UTC (permalink / raw)
To: Pali Rohár
Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel
On Tue, 26 Jul 2022 10:56:12 +0200
Pali Rohár <pali@kernel.org> wrote:
> ioctl(WDIOC_SETTIMEOUT) calls .set_timeout and .ping callbacks and it is
> expected that it changes current watchdog timeout.
>
> armada_37xx_wdt's .ping callback just reping counter 0 and does not touch
> counter 1 used for timeout. So it is needed to set counter 1 to the new
> value in .set_timeout callback to ensure ioctl(WDIOC_SETTIMEOUT)
> functionality. Fix it.
>
> Fixes: 54e3d9b518c8 ("watchdog: Add support for Armada 37xx CPU watchdog")
> Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <kabel@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback
2022-07-26 8:56 [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback Pali Rohár
2022-07-26 13:33 ` Guenter Roeck
2022-07-26 13:45 ` Marek Behún
@ 2022-09-24 10:51 ` Pali Rohár
2 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2022-09-24 10:51 UTC (permalink / raw)
To: Marek Behún, Wim Van Sebroeck, Guenter Roeck
Cc: linux-watchdog, linux-kernel
PING?
On Tuesday 26 July 2022 10:56:12 Pali Rohár wrote:
> ioctl(WDIOC_SETTIMEOUT) calls .set_timeout and .ping callbacks and it is
> expected that it changes current watchdog timeout.
>
> armada_37xx_wdt's .ping callback just reping counter 0 and does not touch
> counter 1 used for timeout. So it is needed to set counter 1 to the new
> value in .set_timeout callback to ensure ioctl(WDIOC_SETTIMEOUT)
> functionality. Fix it.
>
> Fixes: 54e3d9b518c8 ("watchdog: Add support for Armada 37xx CPU watchdog")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> drivers/watchdog/armada_37xx_wdt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c
> index 1635f421ef2c..b84cba94b135 100644
> --- a/drivers/watchdog/armada_37xx_wdt.c
> +++ b/drivers/watchdog/armada_37xx_wdt.c
> @@ -179,6 +179,8 @@ static int armada_37xx_wdt_set_timeout(struct watchdog_device *wdt,
> dev->timeout = (u64)dev->clk_rate * timeout;
> do_div(dev->timeout, CNTR_CTRL_PRESCALE_MIN);
>
> + set_counter_value(dev, CNTR_ID_WDOG, dev->timeout);
> +
> return 0;
> }
>
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-24 10:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 8:56 [PATCH] watchdog: armada_37xx_wdt: Fix .set_timeout callback Pali Rohár
2022-07-26 13:33 ` Guenter Roeck
2022-07-26 13:45 ` Marek Behún
2022-09-24 10:51 ` Pali Rohár
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).