Commit e909074b authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

[S390] cio: ccw group fix unbind behaviour.

For a ccw group device unbinding it from its driver should do the
same as a call to ungroup, since this virtual device can not exist
without a driver.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 50f15483
...@@ -314,16 +314,32 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, ...@@ -314,16 +314,32 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
} }
EXPORT_SYMBOL(ccwgroup_create_from_string); EXPORT_SYMBOL(ccwgroup_create_from_string);
static int __init static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action,
init_ccwgroup (void) void *data);
static struct notifier_block ccwgroup_nb = {
.notifier_call = ccwgroup_notifier
};
static int __init init_ccwgroup(void)
{ {
return bus_register (&ccwgroup_bus_type); int ret;
ret = bus_register(&ccwgroup_bus_type);
if (ret)
return ret;
ret = bus_register_notifier(&ccwgroup_bus_type, &ccwgroup_nb);
if (ret)
bus_unregister(&ccwgroup_bus_type);
return ret;
} }
static void __exit static void __exit cleanup_ccwgroup(void)
cleanup_ccwgroup (void)
{ {
bus_unregister (&ccwgroup_bus_type); bus_unregister_notifier(&ccwgroup_bus_type, &ccwgroup_nb);
bus_unregister(&ccwgroup_bus_type);
} }
module_init(init_ccwgroup); module_init(init_ccwgroup);
...@@ -455,6 +471,7 @@ ccwgroup_remove (struct device *dev) ...@@ -455,6 +471,7 @@ ccwgroup_remove (struct device *dev)
struct ccwgroup_driver *gdrv; struct ccwgroup_driver *gdrv;
device_remove_file(dev, &dev_attr_online); device_remove_file(dev, &dev_attr_online);
device_remove_file(dev, &dev_attr_ungroup);
if (!dev->driver) if (!dev->driver)
return 0; return 0;
...@@ -492,6 +509,19 @@ static struct bus_type ccwgroup_bus_type = { ...@@ -492,6 +509,19 @@ static struct bus_type ccwgroup_bus_type = {
.shutdown = ccwgroup_shutdown, .shutdown = ccwgroup_shutdown,
}; };
static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action,
void *data)
{
struct device *dev = data;
if (action == BUS_NOTIFY_UNBIND_DRIVER)
device_schedule_callback(dev, ccwgroup_ungroup_callback);
return NOTIFY_OK;
}
/** /**
* ccwgroup_driver_register() - register a ccw group driver * ccwgroup_driver_register() - register a ccw group driver
* @cdriver: driver to be registered * @cdriver: driver to be registered
......
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