mei: replace check for connection instead of transitioning
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 26 Mar 2015 22:27:59 +0000 (00:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Apr 2015 14:18:56 +0000 (16:18 +0200)
The function mei_cl_is_transitioning is just opposite
of mei_cl_is_connected. What we actually wanted to
check is if we lost connection so we can discard
the check for transition and check for 'not connected'

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/bus.c
drivers/misc/mei/client.h
drivers/misc/mei/main.c

index b724a67696fc67b59de22f75cc64c76245cb6a14..4cf38c39878aa1787de6cb36cf2a5c045f01b875 100644 (file)
@@ -302,7 +302,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 
                if (wait_event_interruptible(cl->rx_wait,
                                (!list_empty(&cl->rd_completed)) ||
-                               mei_cl_is_transitioning(cl))) {
+                               (!mei_cl_is_connected(cl)))) {
 
                        if (signal_pending(current))
                                return -EINTR;
@@ -311,7 +311,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 
                mutex_lock(&dev->device_lock);
 
-               if (mei_cl_is_transitioning(cl)) {
+               if (!mei_cl_is_connected(cl)) {
                        rets = -EBUSY;
                        goto out;
                }
index 7800d1bd8ba1663c025f3915a5c522afe3003f3d..0a39e5d45171855a642c2bca7d550a223fe94cd7 100644 (file)
@@ -90,16 +90,18 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl);
 /*
  *  MEI input output function prototype
  */
+
+/**
+ * mei_cl_is_connected - host client is connected
+ *
+ * @cl: host clinet
+ *
+ * Return: true if the host clinet is connected
+ */
 static inline bool mei_cl_is_connected(struct mei_cl *cl)
 {
        return  cl->state == MEI_FILE_CONNECTED;
 }
-static inline bool mei_cl_is_transitioning(struct mei_cl *cl)
-{
-       return  MEI_FILE_INITIALIZING == cl->state ||
-               MEI_FILE_DISCONNECTED == cl->state ||
-               MEI_FILE_DISCONNECTING == cl->state;
-}
 
 bool mei_cl_is_other_connecting(struct mei_cl *cl);
 int mei_cl_disconnect(struct mei_cl *cl);
index 29fa88b6fa172b4d4c7b6f3de72a7dffa2e560ae..7f77f39c24a77ccf06a062838b565423d75ccaf9 100644 (file)
@@ -203,7 +203,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
 
                if (wait_event_interruptible(cl->rx_wait,
                                (!list_empty(&cl->rd_completed)) ||
-                               mei_cl_is_transitioning(cl))) {
+                               (!mei_cl_is_connected(cl)))) {
 
                        if (signal_pending(current))
                                return -EINTR;
@@ -211,7 +211,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
                }
 
                mutex_lock(&dev->device_lock);
-               if (mei_cl_is_transitioning(cl)) {
+               if (!mei_cl_is_connected(cl)) {
                        rets = -EBUSY;
                        goto out;
                }