mei: drop read complete queue emptiness check
authorAlexander Usyskin <alexander.usyskin@intel.com>
Thu, 16 Jun 2016 14:58:54 +0000 (17:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Aug 2016 12:36:39 +0000 (14:36 +0200)
In the course of the read flow we want to wait for read completion only
if the read queue is empty.
However the calling list_empty(&cl->rd_completed) is a duplication as the
same check was performed by mei_cl_read_cb() and the waiting is skipped
if it returns not NULL.

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>
drivers/misc/mei/bus.c
drivers/misc/mei/main.c

index 1f33fea9299f61a4b8ceeb127a638ccbf09c312e..63411ddfb83d6bc901f14e8c01ee729af81c8260 100644 (file)
@@ -126,7 +126,8 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
                goto out;
 
        /* wait on event only if there is no other waiter */
-       if (list_empty(&cl->rd_completed) && !waitqueue_active(&cl->rx_wait)) {
+       /* synchronized under device mutex */
+       if (!waitqueue_active(&cl->rx_wait)) {
 
                mutex_unlock(&bus->device_lock);
 
index a8d0471f817f7ebf669fcadd98151c08a5bda2ad..3326bde7fba14c1c40eb2242b10c5c7fa23bfb30 100644 (file)
@@ -183,7 +183,8 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
                goto out;
        }
 
-       if (list_empty(&cl->rd_completed) && !waitqueue_active(&cl->rx_wait)) {
+       /* synchronized under device mutex */
+       if (!waitqueue_active(&cl->rx_wait)) {
                if (file->f_flags & O_NONBLOCK) {
                        rets = -EAGAIN;
                        goto out;