* [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup()
[not found] <cover.1738746821.git.namcao@linutronix.de>
@ 2025-02-05 10:39 ` Nam Cao
2025-02-11 16:16 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Nam Cao @ 2025-02-05 10:39 UTC (permalink / raw)
To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
linux-kernel
Cc: Nam Cao, Wim Van Sebroeck, linux-watchdog
hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of
hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org
---
drivers/watchdog/softdog.c | 8 +++-----
drivers/watchdog/watchdog_dev.c | 4 ++--
drivers/watchdog/watchdog_hrtimer_pretimeout.c | 4 ++--
kernel/watchdog.c | 3 +--
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index 7a1096265f18..0820e35ad2e3 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -187,14 +187,12 @@ static int __init softdog_init(void)
watchdog_set_nowayout(&softdog_dev, nowayout);
watchdog_stop_on_reboot(&softdog_dev);
- hrtimer_init(&softdog_ticktock, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- softdog_ticktock.function = softdog_fire;
+ hrtimer_setup(&softdog_ticktock, softdog_fire, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) {
softdog_info.options |= WDIOF_PRETIMEOUT;
- hrtimer_init(&softdog_preticktock, CLOCK_MONOTONIC,
- HRTIMER_MODE_REL);
- softdog_preticktock.function = softdog_pretimeout;
+ hrtimer_setup(&softdog_preticktock, softdog_pretimeout, CLOCK_MONOTONIC,
+ HRTIMER_MODE_REL);
}
if (soft_active_on_boot)
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 19698d87dc57..8369fd94fc1a 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -1051,8 +1051,8 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
}
kthread_init_work(&wd_data->work, watchdog_ping_work);
- hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
- wd_data->timer.function = watchdog_timer_expired;
+ hrtimer_setup(&wd_data->timer, watchdog_timer_expired, CLOCK_MONOTONIC,
+ HRTIMER_MODE_REL_HARD);
watchdog_hrtimer_pretimeout_init(wdd);
if (wdd->id == 0) {
diff --git a/drivers/watchdog/watchdog_hrtimer_pretimeout.c b/drivers/watchdog/watchdog_hrtimer_pretimeout.c
index 940b53718a91..fbc7eecd8b20 100644
--- a/drivers/watchdog/watchdog_hrtimer_pretimeout.c
+++ b/drivers/watchdog/watchdog_hrtimer_pretimeout.c
@@ -23,8 +23,8 @@ void watchdog_hrtimer_pretimeout_init(struct watchdog_device *wdd)
{
struct watchdog_core_data *wd_data = wdd->wd_data;
- hrtimer_init(&wd_data->pretimeout_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- wd_data->pretimeout_timer.function = watchdog_hrtimer_pretimeout;
+ hrtimer_setup(&wd_data->pretimeout_timer, watchdog_hrtimer_pretimeout, CLOCK_MONOTONIC,
+ HRTIMER_MODE_REL);
}
void watchdog_hrtimer_pretimeout_start(struct watchdog_device *wdd)
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b2da7de39d06..6a98dbc931ac 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -797,8 +797,7 @@ static void watchdog_enable(unsigned int cpu)
* Start the timer first to prevent the hardlockup watchdog triggering
* before the timer has a chance to fire.
*/
- hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
- hrtimer->function = watchdog_timer_fn;
+ hrtimer_setup(hrtimer, watchdog_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
hrtimer_start(hrtimer, ns_to_ktime(sample_period),
HRTIMER_MODE_REL_PINNED_HARD);
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup()
2025-02-05 10:39 ` [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup() Nam Cao
@ 2025-02-11 16:16 ` Guenter Roeck
2025-02-13 11:16 ` Thomas Gleixner
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2025-02-11 16:16 UTC (permalink / raw)
To: Nam Cao
Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
linux-kernel, Wim Van Sebroeck, linux-watchdog
On Wed, Feb 05, 2025 at 11:39:07AM +0100, Nam Cao wrote:
> hrtimer_setup() takes the callback function pointer as argument and
> initializes the timer completely.
>
> Replace hrtimer_init() and the open coded initialization of
> hrtimer::function with the new setup mechanism.
>
> Patch was created by using Coccinelle.
>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
> Cc: linux-watchdog@vger.kernel.org
> ---
Change log missing. I am also personally not a friend of changing
multiple drivers in a single patch for changes like this. That makes
it all but impossible to revert one of the driver changes if it was
wrong without reverting everything.
Guenter
> drivers/watchdog/softdog.c | 8 +++-----
> drivers/watchdog/watchdog_dev.c | 4 ++--
> drivers/watchdog/watchdog_hrtimer_pretimeout.c | 4 ++--
> kernel/watchdog.c | 3 +--
> 4 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
> index 7a1096265f18..0820e35ad2e3 100644
> --- a/drivers/watchdog/softdog.c
> +++ b/drivers/watchdog/softdog.c
> @@ -187,14 +187,12 @@ static int __init softdog_init(void)
> watchdog_set_nowayout(&softdog_dev, nowayout);
> watchdog_stop_on_reboot(&softdog_dev);
>
> - hrtimer_init(&softdog_ticktock, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> - softdog_ticktock.function = softdog_fire;
> + hrtimer_setup(&softdog_ticktock, softdog_fire, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>
> if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) {
> softdog_info.options |= WDIOF_PRETIMEOUT;
> - hrtimer_init(&softdog_preticktock, CLOCK_MONOTONIC,
> - HRTIMER_MODE_REL);
> - softdog_preticktock.function = softdog_pretimeout;
> + hrtimer_setup(&softdog_preticktock, softdog_pretimeout, CLOCK_MONOTONIC,
> + HRTIMER_MODE_REL);
> }
>
> if (soft_active_on_boot)
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index 19698d87dc57..8369fd94fc1a 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -1051,8 +1051,8 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
> }
>
> kthread_init_work(&wd_data->work, watchdog_ping_work);
> - hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
> - wd_data->timer.function = watchdog_timer_expired;
> + hrtimer_setup(&wd_data->timer, watchdog_timer_expired, CLOCK_MONOTONIC,
> + HRTIMER_MODE_REL_HARD);
> watchdog_hrtimer_pretimeout_init(wdd);
>
> if (wdd->id == 0) {
> diff --git a/drivers/watchdog/watchdog_hrtimer_pretimeout.c b/drivers/watchdog/watchdog_hrtimer_pretimeout.c
> index 940b53718a91..fbc7eecd8b20 100644
> --- a/drivers/watchdog/watchdog_hrtimer_pretimeout.c
> +++ b/drivers/watchdog/watchdog_hrtimer_pretimeout.c
> @@ -23,8 +23,8 @@ void watchdog_hrtimer_pretimeout_init(struct watchdog_device *wdd)
> {
> struct watchdog_core_data *wd_data = wdd->wd_data;
>
> - hrtimer_init(&wd_data->pretimeout_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> - wd_data->pretimeout_timer.function = watchdog_hrtimer_pretimeout;
> + hrtimer_setup(&wd_data->pretimeout_timer, watchdog_hrtimer_pretimeout, CLOCK_MONOTONIC,
> + HRTIMER_MODE_REL);
> }
>
> void watchdog_hrtimer_pretimeout_start(struct watchdog_device *wdd)
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index b2da7de39d06..6a98dbc931ac 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -797,8 +797,7 @@ static void watchdog_enable(unsigned int cpu)
> * Start the timer first to prevent the hardlockup watchdog triggering
> * before the timer has a chance to fire.
> */
> - hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
> - hrtimer->function = watchdog_timer_fn;
> + hrtimer_setup(hrtimer, watchdog_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
> hrtimer_start(hrtimer, ns_to_ktime(sample_period),
> HRTIMER_MODE_REL_PINNED_HARD);
>
> --
> 2.39.5
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup()
2025-02-11 16:16 ` Guenter Roeck
@ 2025-02-13 11:16 ` Thomas Gleixner
2025-02-13 12:24 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2025-02-13 11:16 UTC (permalink / raw)
To: Guenter Roeck, Nam Cao
Cc: Anna-Maria Behnsen, Frederic Weisbecker, linux-kernel,
Wim Van Sebroeck, linux-watchdog
On Tue, Feb 11 2025 at 08:16, Guenter Roeck wrote:
> On Wed, Feb 05, 2025 at 11:39:07AM +0100, Nam Cao wrote:
>> hrtimer_setup() takes the callback function pointer as argument and
>> initializes the timer completely.
>>
>> Replace hrtimer_init() and the open coded initialization of
>> hrtimer::function with the new setup mechanism.
>>
>> Patch was created by using Coccinelle.
>>
>> Signed-off-by: Nam Cao <namcao@linutronix.de>
>> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
>> Cc: linux-watchdog@vger.kernel.org
>> ---
>
> Change log missing.
I read the above as a change log, but _I_ might be missing something.
> I am also personally not a friend of changing
> multiple drivers in a single patch for changes like this. That makes
> it all but impossible to revert one of the driver changes if it was
> wrong without reverting everything.
Come on. This is a purely mechanical change which is fully equivalent,
so splitting it up further is just increasing patch count for no value.
Thanks,
tglx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup()
2025-02-13 11:16 ` Thomas Gleixner
@ 2025-02-13 12:24 ` Guenter Roeck
2025-02-13 13:43 ` Nam Cao
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2025-02-13 12:24 UTC (permalink / raw)
To: Thomas Gleixner, Nam Cao
Cc: Anna-Maria Behnsen, Frederic Weisbecker, linux-kernel,
Wim Van Sebroeck, linux-watchdog
On 2/13/25 03:16, Thomas Gleixner wrote:
> On Tue, Feb 11 2025 at 08:16, Guenter Roeck wrote:
>> On Wed, Feb 05, 2025 at 11:39:07AM +0100, Nam Cao wrote:
>>> hrtimer_setup() takes the callback function pointer as argument and
>>> initializes the timer completely.
>>>
>>> Replace hrtimer_init() and the open coded initialization of
>>> hrtimer::function with the new setup mechanism.
>>>
>>> Patch was created by using Coccinelle.
>>>
>>> Signed-off-by: Nam Cao <namcao@linutronix.de>
>>> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
>>> Cc: linux-watchdog@vger.kernel.org
>>> ---
>>
>> Change log missing.
>
> I read the above as a change log, but _I_ might be missing something.
>
I have no idea what changed since v1 or why. If you can see that
in the patch description, good for you.
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup()
2025-02-13 12:24 ` Guenter Roeck
@ 2025-02-13 13:43 ` Nam Cao
0 siblings, 0 replies; 5+ messages in thread
From: Nam Cao @ 2025-02-13 13:43 UTC (permalink / raw)
To: Guenter Roeck
Cc: Thomas Gleixner, Anna-Maria Behnsen, Frederic Weisbecker,
linux-kernel, Wim Van Sebroeck, linux-watchdog
Hi Guenter,
On Thu, Feb 13, 2025 at 04:24:25AM -0800, Guenter Roeck wrote:
> I have no idea what changed since v1 or why. If you can see that
> in the patch description, good for you.
The change log is in the cover letter [1]. I just noticed that I forgot to Cc
the cover letter to the watchdog mailing list, sorry about that!
This v2 is sent due to conflict with 6.14-rc1. Most patches (including this
one) are the same.
Best regards,
Nam
[1] https://lore.kernel.org/lkml/cover.1738746821.git.namcao@linutronix.de/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-02-13 13:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1738746821.git.namcao@linutronix.de>
2025-02-05 10:39 ` [PATCH v2 23/31] watchdog: Switch to use hrtimer_setup() Nam Cao
2025-02-11 16:16 ` Guenter Roeck
2025-02-13 11:16 ` Thomas Gleixner
2025-02-13 12:24 ` Guenter Roeck
2025-02-13 13:43 ` Nam Cao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox