Skip to content

Commit 3b27e2e

Browse files
committed
ACPI: LPIT: move to use bus_get_dev_root()
JIRA: https://issues.redhat.com/browse/RHEL-1023 commit af48ab8 Author: Greg Kroah-Hartman <[email protected]> Date: Wed Mar 22 09:36:46 2023 +0100 Direct access to the struct bus_type dev_root pointer is going away soon so replace that with a call to bus_get_dev_root() instead, which is what it is there for. Cc: Len Brown <[email protected]> Cc: [email protected] Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Mark Langsdorf <[email protected]>
1 parent 0fbd006 commit 3b27e2e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/acpi/acpi_lpit.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ EXPORT_SYMBOL_GPL(lpit_read_residency_count_address);
9898
static void lpit_update_residency(struct lpit_residency_info *info,
9999
struct acpi_lpit_native *lpit_native)
100100
{
101+
struct device *dev_root = bus_get_dev_root(&cpu_subsys);
102+
103+
/* Silently fail, if cpuidle attribute group is not present */
104+
if (!dev_root)
105+
return;
106+
101107
info->frequency = lpit_native->counter_frequency ?
102108
lpit_native->counter_frequency : tsc_khz * 1000;
103109
if (!info->frequency)
@@ -108,18 +114,18 @@ static void lpit_update_residency(struct lpit_residency_info *info,
108114
info->iomem_addr = ioremap(info->gaddr.address,
109115
info->gaddr.bit_width / 8);
110116
if (!info->iomem_addr)
111-
return;
117+
goto exit;
112118

113-
/* Silently fail, if cpuidle attribute group is not present */
114-
sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
119+
sysfs_add_file_to_group(&dev_root->kobj,
115120
&dev_attr_low_power_idle_system_residency_us.attr,
116121
"cpuidle");
117122
} else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
118-
/* Silently fail, if cpuidle attribute group is not present */
119-
sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
123+
sysfs_add_file_to_group(&dev_root->kobj,
120124
&dev_attr_low_power_idle_cpu_residency_us.attr,
121125
"cpuidle");
122126
}
127+
exit:
128+
put_device(dev_root);
123129
}
124130

125131
static void lpit_process(u64 begin, u64 end)

0 commit comments

Comments
 (0)