Commit 57080e88 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

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: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5d882460
...@@ -498,6 +498,25 @@ int mei_cldev_enable(struct mei_cl_device *cldev) ...@@ -498,6 +498,25 @@ int mei_cldev_enable(struct mei_cl_device *cldev)
} }
EXPORT_SYMBOL_GPL(mei_cldev_enable); 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 * mei_cldev_disable - disable me client device
* disconnect form the me client * disconnect form the me client
...@@ -519,6 +538,8 @@ int mei_cldev_disable(struct mei_cl_device *cldev) ...@@ -519,6 +538,8 @@ int mei_cldev_disable(struct mei_cl_device *cldev)
bus = cldev->bus; bus = cldev->bus;
mei_cldev_unregister_callbacks(cldev);
mutex_lock(&bus->device_lock); mutex_lock(&bus->device_lock);
if (!mei_cl_is_connected(cl)) { if (!mei_cl_is_connected(cl)) {
...@@ -700,14 +721,7 @@ static int mei_cl_device_remove(struct device *dev) ...@@ -700,14 +721,7 @@ static int mei_cl_device_remove(struct device *dev)
if (cldrv->remove) if (cldrv->remove)
ret = cldrv->remove(cldev); ret = cldrv->remove(cldev);
if (cldev->rx_cb) { mei_cldev_unregister_callbacks(cldev);
cancel_work_sync(&cldev->rx_work);
cldev->rx_cb = NULL;
}
if (cldev->notif_cb) {
cancel_work_sync(&cldev->notif_work);
cldev->notif_cb = NULL;
}
module_put(THIS_MODULE); module_put(THIS_MODULE);
dev->driver = NULL; dev->driver = NULL;
......
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