Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <rafael.j.wysocki@intel.com>
Tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

+4
+4
drivers/cpuidle/driver.c
··· 183 183 s->target_residency_ns = s->target_residency * NSEC_PER_USEC; 184 184 else if (s->target_residency_ns < 0) 185 185 s->target_residency_ns = 0; 186 + else 187 + s->target_residency = div_u64(s->target_residency_ns, NSEC_PER_USEC); 186 188 187 189 if (s->exit_latency > 0) 188 190 s->exit_latency_ns = s->exit_latency * NSEC_PER_USEC; 189 191 else if (s->exit_latency_ns < 0) 190 192 s->exit_latency_ns = 0; 193 + else 194 + s->exit_latency = div_u64(s->exit_latency_ns, NSEC_PER_USEC); 191 195 } 192 196 } 193 197