OSDN Git Service

USB: serial: option: add Telit 0x1260 and 0x1261 compositions
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / mailbox / mailbox.c
index 6a4811f..9cf826d 100644 (file)
@@ -104,11 +104,14 @@ static void tx_tick(struct mbox_chan *chan, int r)
        /* Submit next message */
        msg_submit(chan);
 
+       if (!mssg)
+               return;
+
        /* Notify the client */
-       if (mssg && chan->cl->tx_done)
+       if (chan->cl->tx_done)
                chan->cl->tx_done(chan->cl, mssg, r);
 
-       if (chan->cl->tx_block)
+       if (r != -ETIME && chan->cl->tx_block)
                complete(&chan->tx_complete);
 }
 
@@ -261,7 +264,7 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
 
        msg_submit(chan);
 
-       if (chan->cl->tx_block && chan->active_req) {
+       if (chan->cl->tx_block) {
                unsigned long wait;
                int ret;
 
@@ -272,8 +275,8 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
 
                ret = wait_for_completion_timeout(&chan->tx_complete, wait);
                if (ret == 0) {
-                       t = -EIO;
-                       tx_tick(chan, -EIO);
+                       t = -ETIME;
+                       tx_tick(chan, t);
                }
        }