diff options
author | Christian Gromm <christian.gromm@microchip.com> | 2015-12-22 10:52:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-07 17:34:58 -0800 |
commit | a0fceb1fb853585dcc7419944eb0ca385bdc497e (patch) | |
tree | af6f81507d93c003678458a692381373fbfba2c2 | |
parent | 245dc23d2368beada77d9bc26f3292fa34931655 (diff) | |
download | linux-a0fceb1fb853585dcc7419944eb0ca385bdc497e.tar.bz2 |
staging: most: move channel disconnect to function most_deregister_interface
This patch moves the code that disconnects linked channels. It is needed
to have cleaning things up done right.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/most/mostcore/core.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index ae1b5778b24b..782747a50477 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -738,20 +738,7 @@ static void destroy_most_inst_obj(struct most_inst_obj *inst) { struct most_c_obj *c, *tmp; - /* need to destroy channels first, since - * each channel incremented the - * reference count of the inst->kobj - */ list_for_each_entry_safe(c, tmp, &inst->channel_list, list) { - if (c->aim0.ptr) - c->aim0.ptr->disconnect_channel(c->iface, - c->channel_id); - if (c->aim1.ptr) - c->aim1.ptr->disconnect_channel(c->iface, - c->channel_id); - c->aim0.ptr = NULL; - c->aim1.ptr = NULL; - mutex_lock(&deregister_mutex); flush_trash_fifo(c); flush_channel_fifos(c); @@ -1837,6 +1824,17 @@ void most_deregister_interface(struct most_interface *iface) pr_info("deregistering MOST device %s (%s)\n", i->kobj.name, iface->description); + list_for_each_entry(c, &i->channel_list, list) { + if (c->aim0.ptr) + c->aim0.ptr->disconnect_channel(c->iface, + c->channel_id); + if (c->aim1.ptr) + c->aim1.ptr->disconnect_channel(c->iface, + c->channel_id); + c->aim0.ptr = NULL; + c->aim1.ptr = NULL; + } + mutex_lock(&deregister_mutex); atomic_set(&i->tainted, 1); mutex_unlock(&deregister_mutex); |