diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-02-17 08:13:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-18 13:04:35 -0500 |
commit | 487056932d372cc4f6c636f21a928d6667b151d7 (patch) | |
tree | eba69647e4de95664345f76bdc984aa5c2f86032 /drivers/misc/mei | |
parent | ba4b60e85d6c5fc2242fd24e131a47fb922e5d89 (diff) |
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')
-rw-r--r-- | drivers/misc/mei/bus.c | 16 | ||||
-rw-r--r-- | drivers/misc/mei/init.c | 2 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 1 | ||||
-rw-r--r-- | drivers/misc/mei/nfc.c | 8 |
4 files changed, 20 insertions, 7 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) | |||
524 | schedule_work(&device->event_work); | 524 | schedule_work(&device->event_work); |
525 | } | 525 | } |
526 | 526 | ||
527 | void mei_cl_bus_remove_devices(struct mei_device *dev) | ||
528 | { | ||
529 | struct mei_cl *cl, *next; | ||
530 | |||
531 | mutex_lock(&dev->device_lock); | ||
532 | list_for_each_entry_safe(cl, next, &dev->device_list, device_link) { | ||
533 | if (cl->device) | ||
534 | mei_cl_remove_device(cl->device); | ||
535 | |||
536 | list_del(&cl->device_link); | ||
537 | mei_cl_unlink(cl); | ||
538 | kfree(cl); | ||
539 | } | ||
540 | mutex_unlock(&dev->device_lock); | ||
541 | } | ||
542 | |||
527 | int __init mei_cl_bus_init(void) | 543 | int __init mei_cl_bus_init(void) |
528 | { | 544 | { |
529 | return bus_register(&mei_cl_bus_type); | 545 | return bus_register(&mei_cl_bus_type); |
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 214dcef9750a..4460975c0eef 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -288,6 +288,8 @@ void mei_stop(struct mei_device *dev) | |||
288 | 288 | ||
289 | mei_nfc_host_exit(dev); | 289 | mei_nfc_host_exit(dev); |
290 | 290 | ||
291 | mei_cl_bus_remove_devices(dev); | ||
292 | |||
291 | mutex_lock(&dev->device_lock); | 293 | mutex_lock(&dev->device_lock); |
292 | 294 | ||
293 | mei_wd_stop(dev); | 295 | mei_wd_stop(dev); |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index 21e52496bc6e..49025fa202ae 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -296,6 +296,7 @@ int __mei_cl_async_send(struct mei_cl *cl, u8 *buf, size_t length); | |||
296 | int __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length); | 296 | int __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length); |
297 | int __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length); | 297 | int __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length); |
298 | void mei_cl_bus_rx_event(struct mei_cl *cl); | 298 | void mei_cl_bus_rx_event(struct mei_cl *cl); |
299 | void mei_cl_bus_remove_devices(struct mei_device *dev); | ||
299 | int mei_cl_bus_init(void); | 300 | int mei_cl_bus_init(void); |
300 | void mei_cl_bus_exit(void); | 301 | void mei_cl_bus_exit(void); |
301 | 302 | ||
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c index a58320c0c049..7626dde5e1f5 100644 --- a/drivers/misc/mei/nfc.c +++ b/drivers/misc/mei/nfc.c | |||
@@ -552,13 +552,7 @@ err: | |||
552 | void mei_nfc_host_exit(struct mei_device *dev) | 552 | void mei_nfc_host_exit(struct mei_device *dev) |
553 | { | 553 | { |
554 | struct mei_nfc_dev *ndev = &nfc_dev; | 554 | struct mei_nfc_dev *ndev = &nfc_dev; |
555 | |||
556 | cancel_work_sync(&ndev->init_work); | 555 | cancel_work_sync(&ndev->init_work); |
556 | } | ||
557 | 557 | ||
558 | mutex_lock(&dev->device_lock); | ||
559 | if (ndev->cl && ndev->cl->device) | ||
560 | mei_cl_remove_device(ndev->cl->device); | ||
561 | 558 | ||
562 | mei_nfc_free(ndev); | ||
563 | mutex_unlock(&dev->device_lock); | ||
564 | } | ||