Skip to content

Commit 03cf825

Browse files
Xichao Zhaorafaeljw
authored andcommitted
powercap: idle_inject: use us_to_ktime() where appropriate
Convert values in microseconds to ktime using us_to_ktime() instead of multiplying them by NSEC_PER_USEC and using ns_to_ktime() for the conversion. Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com> Link: https://patch.msgid.link/20250813075433.464786-1-zhao.xichao@vivo.com [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent c17b750 commit 03cf825

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/powercap/idle_inject.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *timer)
133133
duration_us = READ_ONCE(ii_dev->run_duration_us);
134134
duration_us += READ_ONCE(ii_dev->idle_duration_us);
135135

136-
hrtimer_forward_now(timer, ns_to_ktime(duration_us * NSEC_PER_USEC));
136+
hrtimer_forward_now(timer, us_to_ktime(duration_us));
137137

138138
return HRTIMER_RESTART;
139139
}
@@ -232,8 +232,7 @@ int idle_inject_start(struct idle_inject_device *ii_dev)
232232
idle_inject_wakeup(ii_dev);
233233

234234
hrtimer_start(&ii_dev->timer,
235-
ns_to_ktime((idle_duration_us + run_duration_us) *
236-
NSEC_PER_USEC),
235+
us_to_ktime(idle_duration_us + run_duration_us),
237236
HRTIMER_MODE_REL);
238237

239238
return 0;

0 commit comments

Comments
 (0)