Commit d7f9be48 authored by Matt Porter's avatar Matt Porter Committed by Greg Kroah-Hartman

greybus: implement core module removal path

Implement gb_remove_module() by finding the gb_module to
be removed via the supplied module_id. Add support for
removing the actual device into greybus_remove_device()
after all the subdevs are disconnected.
Signed-off-by: default avatarMatt Porter <mporter@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 32dff13d
......@@ -252,7 +252,19 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id,
void gb_remove_module(struct greybus_host_device *hd, u8 module_id)
{
// FIXME should be the remove_device call...
struct gb_module *gmod;
bool found = false;
list_for_each_entry(gmod, &hd->modules, links)
if (gmod->module_id == module_id) {
found = true;
break;
}
if (found)
greybus_remove_device(gmod);
else
dev_err(hd->parent, "module id %d remove error\n", module_id);
}
void greybus_remove_device(struct gb_module *gmod)
......@@ -264,7 +276,8 @@ void greybus_remove_device(struct gb_module *gmod)
gb_tty_disconnect(gmod);
gb_battery_disconnect(gmod);
// FIXME - device_remove(&gmod->dev);
device_del(&gmod->dev);
put_device(&gmod->dev);
}
static DEFINE_MUTEX(hd_mutex);
......
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