summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2015-02-10 10:39:47 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-01 19:37:00 -0800
commitb3de8e3719e582f3182bb504295e4a8e43c8c96f (patch)
treed8f70d9cedaadb0e2a9e917b9af8f471d39fef69 /drivers/misc
parenta9bed61053af13c0768f82c9d1c8793515dd067c (diff)
downloadop-kernel-dev-b3de8e3719e582f3182bb504295e4a8e43c8c96f.zip
op-kernel-dev-b3de8e3719e582f3182bb504295e4a8e43c8c96f.tar.gz
mei: bus: call device disable handler prior to disconnection
call device's disable handler prior to disconnection so it can possibly close the communication with fw client in graceful way 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.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 17ca7e2..45896f9 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -467,37 +467,34 @@ int mei_cl_disable_device(struct mei_cl_device *device)
dev = cl->dev;
+ if (device->ops && device->ops->disable)
+ device->ops->disable(device);
+
+ device->event_cb = NULL;
+
mutex_lock(&dev->device_lock);
if (cl->state != MEI_FILE_CONNECTED) {
- mutex_unlock(&dev->device_lock);
dev_err(dev->dev, "Already disconnected");
-
- return 0;
+ err = 0;
+ goto out;
}
cl->state = MEI_FILE_DISCONNECTING;
err = mei_cl_disconnect(cl);
if (err < 0) {
- mutex_unlock(&dev->device_lock);
- dev_err(dev->dev,
- "Could not disconnect from the ME client");
-
- return err;
+ dev_err(dev->dev, "Could not disconnect from the ME client");
+ goto out;
}
/* Flush queues and remove any pending read */
mei_cl_flush_queues(cl, NULL);
- device->event_cb = NULL;
-
+out:
mutex_unlock(&dev->device_lock);
+ return err;
- if (!device->ops || !device->ops->disable)
- return 0;
-
- return device->ops->disable(device);
}
EXPORT_SYMBOL_GPL(mei_cl_disable_device);
OpenPOWER on IntegriCloud