diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2017-01-27 16:32:40 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-31 11:07:43 +0100 |
commit | 57080e88240a46c62cf7538de009545eb03d2568 (patch) | |
tree | 580e8c36ff7a5b9e5738845bfc6de03b0c0b3904 /drivers/misc | |
parent | 5d88246090c5e9b178eb05bcfb52bbaad2ae48f3 (diff) | |
download | op-kernel-dev-57080e88240a46c62cf7538de009545eb03d2568.zip op-kernel-dev-57080e88240a46c62cf7538de009545eb03d2568.tar.gz |
mei: bus: unregister callbacks upon me client disable call
Stop and unregister receive and notification callbacks
from the disable function, to allow its later re-enablement.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/bus.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index b67f15b..cb3e9e0 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -499,6 +499,25 @@ out: EXPORT_SYMBOL_GPL(mei_cldev_enable); /** + * mei_cldev_unregister_callbacks - internal wrapper for unregistering + * callbacks. + * + * @cldev: client device + */ +static void mei_cldev_unregister_callbacks(struct mei_cl_device *cldev) +{ + if (cldev->rx_cb) { + cancel_work_sync(&cldev->rx_work); + cldev->rx_cb = NULL; + } + + if (cldev->notif_cb) { + cancel_work_sync(&cldev->notif_work); + cldev->notif_cb = NULL; + } +} + +/** * mei_cldev_disable - disable me client device * disconnect form the me client * @@ -519,6 +538,8 @@ int mei_cldev_disable(struct mei_cl_device *cldev) bus = cldev->bus; + mei_cldev_unregister_callbacks(cldev); + mutex_lock(&bus->device_lock); if (!mei_cl_is_connected(cl)) { @@ -700,14 +721,7 @@ static int mei_cl_device_remove(struct device *dev) if (cldrv->remove) ret = cldrv->remove(cldev); - if (cldev->rx_cb) { - cancel_work_sync(&cldev->rx_work); - cldev->rx_cb = NULL; - } - if (cldev->notif_cb) { - cancel_work_sync(&cldev->notif_work); - cldev->notif_cb = NULL; - } + mei_cldev_unregister_callbacks(cldev); module_put(THIS_MODULE); dev->driver = NULL; |