static int __init pseries_energy_init(void)
 {
        int cpu, err;
-       struct device *cpu_dev;
+       struct device *cpu_dev, *dev_root;
 
        if (!firmware_has_feature(FW_FEATURE_BEST_ENERGY))
                return 0; /* H_BEST_ENERGY hcall not supported */
 
        /* Create the sysfs files */
-       err = device_create_file(cpu_subsys.dev_root,
-                               &attr_cpu_activate_hint_list);
-       if (!err)
-               err = device_create_file(cpu_subsys.dev_root,
-                               &attr_cpu_deactivate_hint_list);
+       dev_root = bus_get_dev_root(&cpu_subsys);
+       if (dev_root) {
+               err = device_create_file(dev_root, &attr_cpu_activate_hint_list);
+               if (!err)
+                       err = device_create_file(dev_root, &attr_cpu_deactivate_hint_list);
+               put_device(dev_root);
+               if (err)
+                       return err;
+       }
 
-       if (err)
-               return err;
        for_each_possible_cpu(cpu) {
                cpu_dev = get_cpu_device(cpu);
                err = device_create_file(cpu_dev,
 static void __exit pseries_energy_cleanup(void)
 {
        int cpu;
-       struct device *cpu_dev;
+       struct device *cpu_dev, *dev_root;
 
        if (!sysfs_entries)
                return;
 
        /* Remove the sysfs files */
-       device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list);
-       device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list);
+       dev_root = bus_get_dev_root(&cpu_subsys);
+       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) {
                cpu_dev = get_cpu_device(cpu);
 
  **/
 static int pseries_suspend_sysfs_register(struct device *dev)
 {
+       struct device *dev_root;
        int rc;
 
        if ((rc = subsys_system_register(&suspend_subsys, NULL)))
        dev->id = 0;
        dev->bus = &suspend_subsys;
 
-       if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate)))
-               goto subsys_unregister;
+       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;
+       }
 
        return 0;