diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-02-17 17:13:19 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-18 22:04:35 +0400 |
commit | 487056932d372cc4f6c636f21a928d6667b151d7 (patch) | |
tree | eba69647e4de95664345f76bdc984aa5c2f86032 /drivers/misc/mei/bus.c | |
parent | ba4b60e85d6c5fc2242fd24e131a47fb922e5d89 (diff) | |
download | linux-487056932d372cc4f6c636f21a928d6667b151d7.tar.xz |
mei: Remove all bus devices from the mei_dev list when stopping the MEI
When stopping the MEI, we should remove and potentially unregister
all bus devices queued on the mei_dev linked list.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/bus.c')
-rw-r--r-- | drivers/misc/mei/bus.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 4bc7d620d695..cf4cc0bf2b17 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -524,6 +524,22 @@ void mei_cl_bus_rx_event(struct mei_cl *cl) schedule_work(&device->event_work); } +void mei_cl_bus_remove_devices(struct mei_device *dev) +{ + struct mei_cl *cl, *next; + + mutex_lock(&dev->device_lock); + list_for_each_entry_safe(cl, next, &dev->device_list, device_link) { + if (cl->device) + mei_cl_remove_device(cl->device); + + list_del(&cl->device_link); + mei_cl_unlink(cl); + kfree(cl); + } + mutex_unlock(&dev->device_lock); +} + int __init mei_cl_bus_init(void) { return bus_register(&mei_cl_bus_type); |