Commit 2a9efef8 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

powerpc/pseries: 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: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linuxppc-dev@lists.ozlabs.org
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Link: https://lore.kernel.org/r/20230313182918.1312597-14-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3bf88c42
...@@ -300,20 +300,22 @@ static struct device_attribute attr_percpu_deactivate_hint = ...@@ -300,20 +300,22 @@ static struct device_attribute attr_percpu_deactivate_hint =
static int __init pseries_energy_init(void) static int __init pseries_energy_init(void)
{ {
int cpu, err; int cpu, err;
struct device *cpu_dev; struct device *cpu_dev, *dev_root;
if (!firmware_has_feature(FW_FEATURE_BEST_ENERGY)) if (!firmware_has_feature(FW_FEATURE_BEST_ENERGY))
return 0; /* H_BEST_ENERGY hcall not supported */ return 0; /* H_BEST_ENERGY hcall not supported */
/* Create the sysfs files */ /* Create the sysfs files */
err = device_create_file(cpu_subsys.dev_root, dev_root = bus_get_dev_root(&cpu_subsys);
&attr_cpu_activate_hint_list); if (dev_root) {
err = device_create_file(dev_root, &attr_cpu_activate_hint_list);
if (!err) if (!err)
err = device_create_file(cpu_subsys.dev_root, err = device_create_file(dev_root, &attr_cpu_deactivate_hint_list);
&attr_cpu_deactivate_hint_list); put_device(dev_root);
if (err) if (err)
return err; return err;
}
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
cpu_dev = get_cpu_device(cpu); cpu_dev = get_cpu_device(cpu);
err = device_create_file(cpu_dev, err = device_create_file(cpu_dev,
...@@ -337,14 +339,18 @@ static int __init pseries_energy_init(void) ...@@ -337,14 +339,18 @@ static int __init pseries_energy_init(void)
static void __exit pseries_energy_cleanup(void) static void __exit pseries_energy_cleanup(void)
{ {
int cpu; int cpu;
struct device *cpu_dev; struct device *cpu_dev, *dev_root;
if (!sysfs_entries) if (!sysfs_entries)
return; return;
/* Remove the sysfs files */ /* Remove the sysfs files */
device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list); dev_root = bus_get_dev_root(&cpu_subsys);
device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list); if (dev_root) {
device_remove_file(dev_root, &attr_cpu_activate_hint_list);
device_remove_file(dev_root, &attr_cpu_deactivate_hint_list);
put_device(dev_root);
}
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
cpu_dev = get_cpu_device(cpu); cpu_dev = get_cpu_device(cpu);
......
...@@ -143,6 +143,7 @@ static const struct platform_suspend_ops pseries_suspend_ops = { ...@@ -143,6 +143,7 @@ static const struct platform_suspend_ops pseries_suspend_ops = {
**/ **/
static int pseries_suspend_sysfs_register(struct device *dev) static int pseries_suspend_sysfs_register(struct device *dev)
{ {
struct device *dev_root;
int rc; int rc;
if ((rc = subsys_system_register(&suspend_subsys, NULL))) if ((rc = subsys_system_register(&suspend_subsys, NULL)))
...@@ -151,8 +152,13 @@ static int pseries_suspend_sysfs_register(struct device *dev) ...@@ -151,8 +152,13 @@ static int pseries_suspend_sysfs_register(struct device *dev)
dev->id = 0; dev->id = 0;
dev->bus = &suspend_subsys; dev->bus = &suspend_subsys;
if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate))) dev_root = bus_get_dev_root(&suspend_subsys);
if (dev_root) {
rc = device_create_file(dev_root, &dev_attr_hibernate);
put_device(dev_root);
if (rc)
goto subsys_unregister; goto subsys_unregister;
}
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment