move common workqueue and class init/exit to core

This commit is contained in:
Ralph Metzler
2017-10-22 20:58:58 +02:00
parent 3a2e87eefe
commit e239a6d772
4 changed files with 39 additions and 30 deletions

View File

@@ -4422,3 +4422,24 @@ void ddb_unmap(struct ddb *dev)
vfree(dev);
}
int ddb_exit_ddbridge(int stage, int error)
{
switch (stage) {
default:
case 2:
destroy_workqueue(ddb_wq);
case 1:
ddb_class_destroy();
}
return error;
}
int ddb_init_ddbridge(void)
{
if (ddb_class_create() < 0)
return -1;
ddb_wq = alloc_workqueue("ddbridge", 0, 0);
if (!ddb_wq)
return ddb_exit_ddbridge(1, -1);
return 0;
}