Skip to content

Commit 41204a6

Browse files
committed
cpuidle: driver: Update microsecond values of state parameters as needed
If the cpuidle driver provides the target residency and exit latency in nanoseconds, the corresponding values in microseconds need to be set to reflect the provided numbers in order for the sysfs interface to show them correctly, so make __cpuidle_driver_init() do that. Signed-off-by: Rafael J. Wysocki <[email protected]> Tested-by: Artem Bityutskiy <[email protected]>
1 parent e898b07 commit 41204a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/cpuidle/driver.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,15 @@ static void __cpuidle_driver_init(struct cpuidle_driver *drv)
183183
s->target_residency_ns = s->target_residency * NSEC_PER_USEC;
184184
else if (s->target_residency_ns < 0)
185185
s->target_residency_ns = 0;
186+
else
187+
s->target_residency = div_u64(s->target_residency_ns, NSEC_PER_USEC);
186188

187189
if (s->exit_latency > 0)
188190
s->exit_latency_ns = s->exit_latency * NSEC_PER_USEC;
189191
else if (s->exit_latency_ns < 0)
190192
s->exit_latency_ns = 0;
193+
else
194+
s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC);
191195
}
192196
}
193197

0 commit comments

Comments
 (0)