Commit 45ddea8a authored by Sukadev Bhattiprolu's avatar Sukadev Bhattiprolu Committed by Michael Ellerman

powerpc/vas: Fix cleanup when VAS is not configured

When VAS is not configured, unregister the platform driver. Also simplify
cleanup by delaying vas debugfs init until we know VAS is configured.
Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 720c8404
...@@ -179,6 +179,7 @@ void vas_instance_init_dbgdir(struct vas_instance *vinst) ...@@ -179,6 +179,7 @@ void vas_instance_init_dbgdir(struct vas_instance *vinst)
{ {
struct dentry *d; struct dentry *d;
vas_init_dbgdir();
if (!vas_debugfs) if (!vas_debugfs)
return; return;
...@@ -201,8 +202,18 @@ void vas_instance_init_dbgdir(struct vas_instance *vinst) ...@@ -201,8 +202,18 @@ void vas_instance_init_dbgdir(struct vas_instance *vinst)
vinst->dbgdir = NULL; vinst->dbgdir = NULL;
} }
/*
* Set up the "root" VAS debugfs dir. Return if we already set it up
* (or failed to) in an earlier instance of VAS.
*/
void vas_init_dbgdir(void) void vas_init_dbgdir(void)
{ {
static bool first_time = true;
if (!first_time)
return;
first_time = false;
vas_debugfs = debugfs_create_dir("vas", NULL); vas_debugfs = debugfs_create_dir("vas", NULL);
if (IS_ERR(vas_debugfs)) if (IS_ERR(vas_debugfs))
vas_debugfs = NULL; vas_debugfs = NULL;
......
...@@ -160,8 +160,6 @@ static int __init vas_init(void) ...@@ -160,8 +160,6 @@ static int __init vas_init(void)
int found = 0; int found = 0;
struct device_node *dn; struct device_node *dn;
vas_init_dbgdir();
platform_driver_register(&vas_driver); platform_driver_register(&vas_driver);
for_each_compatible_node(dn, NULL, "ibm,vas") { for_each_compatible_node(dn, NULL, "ibm,vas") {
...@@ -169,8 +167,10 @@ static int __init vas_init(void) ...@@ -169,8 +167,10 @@ static int __init vas_init(void)
found++; found++;
} }
if (!found) if (!found) {
platform_driver_unregister(&vas_driver);
return -ENODEV; return -ENODEV;
}
pr_devel("Found %d instances\n", found); pr_devel("Found %d instances\n", found);
......
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