Skip to content

Commit

Permalink
powerpc/fsl: move to use bus_get_dev_root()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Kroah-Hartman committed Mar 17, 2023
1 parent 2a9efef commit c93bd17
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static struct device_attribute mpic_attributes = __ATTR(timer_wakeup, 0644,

static int __init fsl_wakeup_sys_init(void)
{
struct device *dev_root;
int ret;

fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL);
Expand All @@ -124,16 +125,26 @@ static int __init fsl_wakeup_sys_init(void)

INIT_WORK(&fsl_wakeup->free_work, fsl_free_resource);

ret = device_create_file(mpic_subsys.dev_root, &mpic_attributes);
if (ret)
kfree(fsl_wakeup);
dev_root = bus_get_dev_root(&mpic_subsys);
if (dev_root) {
ret = device_create_file(dev_root, &mpic_attributes);
put_device(dev_root);
if (ret)
kfree(fsl_wakeup);
}

return ret;
}

static void __exit fsl_wakeup_sys_exit(void)
{
device_remove_file(mpic_subsys.dev_root, &mpic_attributes);
struct device *dev_root;

dev_root = bus_get_dev_root(&mpic_subsys);
if (dev_root) {
device_remove_file(dev_root, &mpic_attributes);
put_device(dev_root);
}

mutex_lock(&sysfs_lock);

Expand Down

0 comments on commit c93bd17

Please sign in to comment.