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

powerpc/fsl: 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: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230313182918.1312597-15-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+15 -4
+15 -4
arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
··· 116 116 117 117 static int __init fsl_wakeup_sys_init(void) 118 118 { 119 + struct device *dev_root; 119 120 int ret; 120 121 121 122 fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL); ··· 125 124 126 125 INIT_WORK(&fsl_wakeup->free_work, fsl_free_resource); 127 126 128 - ret = device_create_file(mpic_subsys.dev_root, &mpic_attributes); 129 - if (ret) 130 - kfree(fsl_wakeup); 127 + dev_root = bus_get_dev_root(&mpic_subsys); 128 + if (dev_root) { 129 + ret = device_create_file(dev_root, &mpic_attributes); 130 + put_device(dev_root); 131 + if (ret) 132 + kfree(fsl_wakeup); 133 + } 131 134 132 135 return ret; 133 136 } 134 137 135 138 static void __exit fsl_wakeup_sys_exit(void) 136 139 { 137 - device_remove_file(mpic_subsys.dev_root, &mpic_attributes); 140 + struct device *dev_root; 141 + 142 + dev_root = bus_get_dev_root(&mpic_subsys); 143 + if (dev_root) { 144 + device_remove_file(dev_root, &mpic_attributes); 145 + put_device(dev_root); 146 + } 138 147 139 148 mutex_lock(&sysfs_lock); 140 149