summaryrefslogtreecommitdiff
path: root/drivers/misc/mei/main.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-09-02 13:29:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 13:56:53 -0700
commite2b31644e999e8bfe3efce880fb32840299abf41 (patch)
tree092f58faecfc5a79efc4e31c709f6312a38c255f /drivers/misc/mei/main.c
parent1aee351a739153529fbb98ee461777b2abd5e1c9 (diff)
downloadkernel-common-e2b31644e999e8bfe3efce880fb32840299abf41.tar.gz
kernel-common-e2b31644e999e8bfe3efce880fb32840299abf41.tar.bz2
kernel-common-e2b31644e999e8bfe3efce880fb32840299abf41.zip
mei: bus: stop wait for read during cl state transition
Bus layer omitted check for client state transition while waiting for read completion The client state transition may occur for example as result of firmware initiated reset Add mei_cl_is_transitioning wrapper to reduce the code repetition.: Cc: <stable@vger.kernel.org> # 3.9+ Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/main.c')
-rw-r--r--drivers/misc/mei/main.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 173ff095be0d..cabeddd66c1f 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -249,19 +249,16 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
mutex_unlock(&dev->device_lock);
if (wait_event_interruptible(cl->rx_wait,
- (MEI_READ_COMPLETE == cl->reading_state ||
- MEI_FILE_INITIALIZING == cl->state ||
- MEI_FILE_DISCONNECTED == cl->state ||
- MEI_FILE_DISCONNECTING == cl->state))) {
+ MEI_READ_COMPLETE == cl->reading_state ||
+ mei_cl_is_transitioning(cl))) {
+
if (signal_pending(current))
return -EINTR;
return -ERESTARTSYS;
}
mutex_lock(&dev->device_lock);
- if (MEI_FILE_INITIALIZING == cl->state ||
- MEI_FILE_DISCONNECTED == cl->state ||
- MEI_FILE_DISCONNECTING == cl->state) {
+ if (mei_cl_is_transitioning(cl)) {
rets = -EBUSY;
goto out;
}