Skip to content

Commit d9a6724

Browse files
covanamKAGA-KOKO
authored andcommitted
powercap: Switch to use hrtimer_setup()
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Acked-by: Zack Rusin <[email protected]> Link: https://lore.kernel.org/all/fffc5ecc232069d91817b519dcafd8985120e51c.1738746904.git.namcao@linutronix.de
1 parent 5e55888 commit d9a6724

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

drivers/powercap/idle_inject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ struct idle_inject_device *idle_inject_register_full(struct cpumask *cpumask,
339339
return NULL;
340340

341341
cpumask_copy(to_cpumask(ii_dev->cpumask), cpumask);
342-
hrtimer_init(&ii_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
343-
ii_dev->timer.function = idle_inject_timer_fn;
342+
hrtimer_setup(&ii_dev->timer, idle_inject_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
344343
ii_dev->latency_us = UINT_MAX;
345344
ii_dev->update = update;
346345

drivers/powercap/intel_rapl_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,8 +2064,7 @@ int rapl_package_add_pmu(struct rapl_package *rp)
20642064
raw_spin_lock_init(&data->lock);
20652065
INIT_LIST_HEAD(&data->active_list);
20662066
data->timer_interval = ms_to_ktime(rapl_pmu.timer_ms);
2067-
hrtimer_init(&data->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
2068-
data->hrtimer.function = rapl_hrtimer_handle;
2067+
hrtimer_setup(&data->hrtimer, rapl_hrtimer_handle, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
20692068

20702069
return rapl_pmu_update(rp);
20712070
}

0 commit comments

Comments
 (0)