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

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: LPIT: move to use bus_get_dev_root()

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 <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20230322083646.2937580-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+11 -5
+11 -5
drivers/acpi/acpi_lpit.c
··· 98 98 static void lpit_update_residency(struct lpit_residency_info *info, 99 99 struct acpi_lpit_native *lpit_native) 100 100 { 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 + 101 107 info->frequency = lpit_native->counter_frequency ? 102 108 lpit_native->counter_frequency : tsc_khz * 1000; 103 109 if (!info->frequency) ··· 114 108 info->iomem_addr = ioremap(info->gaddr.address, 115 109 info->gaddr.bit_width / 8); 116 110 if (!info->iomem_addr) 117 - return; 111 + goto exit; 118 112 119 - /* Silently fail, if cpuidle attribute group is not present */ 120 - sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj, 113 + sysfs_add_file_to_group(&dev_root->kobj, 121 114 &dev_attr_low_power_idle_system_residency_us.attr, 122 115 "cpuidle"); 123 116 } else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) { 124 - /* Silently fail, if cpuidle attribute group is not present */ 125 - sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj, 117 + sysfs_add_file_to_group(&dev_root->kobj, 126 118 &dev_attr_low_power_idle_cpu_residency_us.attr, 127 119 "cpuidle"); 128 120 } 121 + exit: 122 + put_device(dev_root); 129 123 } 130 124 131 125 static void lpit_process(u64 begin, u64 end)