powerpc/powernv: move to use bus_get_dev_root()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Mar 2023 18:28:55 +0000 (19:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 14:29:36 +0000 (15:29 +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: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Liang He <windhl@126.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230313182918.1312597-13-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/powernv/idle.c
arch/powerpc/platforms/powernv/subcore.c

index 841cb7f..6dfe8d6 100644 (file)
@@ -1464,14 +1464,19 @@ static int __init pnv_init_idle_states(void)
                        power7_fastsleep_workaround_entry = false;
                        power7_fastsleep_workaround_exit = false;
                } else {
+                       struct device *dev_root;
                        /*
                         * OPAL_PM_SLEEP_ENABLED_ER1 is set. It indicates that
                         * workaround is needed to use fastsleep. Provide sysfs
                         * control to choose how this workaround has to be
                         * applied.
                         */
-                       device_create_file(cpu_subsys.dev_root,
-                               &dev_attr_fastsleep_workaround_applyonce);
+                       dev_root = bus_get_dev_root(&cpu_subsys);
+                       if (dev_root) {
+                               device_create_file(dev_root,
+                                                  &dev_attr_fastsleep_workaround_applyonce);
+                               put_device(dev_root);
+                       }
                }
 
                update_subcore_sibling_mask();
index 7e98b00..428532a 100644 (file)
@@ -415,7 +415,9 @@ static DEVICE_ATTR(subcores_per_core, 0644,
 
 static int subcore_init(void)
 {
+       struct device *dev_root;
        unsigned pvr_ver;
+       int rc = 0;
 
        pvr_ver = PVR_VER(mfspr(SPRN_PVR));
 
@@ -435,7 +437,11 @@ static int subcore_init(void)
 
        set_subcores_per_core(1);
 
-       return device_create_file(cpu_subsys.dev_root,
-                                 &dev_attr_subcores_per_core);
+       dev_root = bus_get_dev_root(&cpu_subsys);
+       if (dev_root) {
+               rc = device_create_file(dev_root, &dev_attr_subcores_per_core);
+               put_device(dev_root);
+       }
+       return rc;
 }
 machine_device_initcall(powernv, subcore_init);