mei: request autosuspend at the end of write
authorAlexander Usyskin <alexander.usyskin@intel.com>
Thu, 7 May 2015 12:53:59 +0000 (15:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 May 2015 18:15:53 +0000 (11:15 -0700)
On longer non-blocking write might not complete at the end of
autosuspend expiration, therefore we request autosuspend
again on the write completion.

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/client.c

index ce88c2199b2c40209582cf57a436fd1b001492b9..7a5a6636f0fd07ae2447ce8bd5a9420fcb1a1c5b 100644 (file)
@@ -1459,12 +1459,18 @@ err:
  */
 void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb)
 {
+       struct mei_device *dev = cl->dev;
+
        switch (cb->fop_type) {
        case MEI_FOP_WRITE:
                mei_io_cb_free(cb);
                cl->writing_state = MEI_WRITE_COMPLETE;
-               if (waitqueue_active(&cl->tx_wait))
+               if (waitqueue_active(&cl->tx_wait)) {
                        wake_up_interruptible(&cl->tx_wait);
+               } else {
+                       pm_runtime_mark_last_busy(dev->dev);
+                       pm_request_autosuspend(dev->dev);
+               }
                break;
 
        case MEI_FOP_READ: