]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/misc/mei/hw-me.c
mei: revamp writing slot counting
[karo-tx-linux.git] / drivers / misc / mei / hw-me.c
index 6f656c053b144a44b20b798e75e16f3efab49f7f..84165cce57d2ef6cef31530d7e3a409954b14603 100644 (file)
@@ -240,7 +240,7 @@ static int mei_me_hw_ready_wait(struct mei_device *dev)
        mutex_unlock(&dev->device_lock);
        err = wait_event_interruptible_timeout(dev->wait_hw_ready,
                        dev->recvd_hw_ready,
-                       mei_secs_to_jiffies(MEI_INTEROP_TIMEOUT));
+                       mei_secs_to_jiffies(MEI_HW_READY_TIMEOUT));
        mutex_lock(&dev->device_lock);
        if (!err && !dev->recvd_hw_ready) {
                if (!err)
@@ -354,7 +354,7 @@ static int mei_me_write_message(struct mei_device *dev,
 
        dw_cnt = mei_data2slots(length);
        if (empty_slots < 0 || dw_cnt > empty_slots)
-               return -EIO;
+               return -EMSGSIZE;
 
        mei_me_reg_write(hw, H_CB_WW, *((u32 *) header));
 
@@ -505,9 +505,6 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
        /* check slots available for reading */
        slots = mei_count_full_read_slots(dev);
        while (slots > 0) {
-               /* we have urgent data to send so break the read */
-               if (dev->wr_ext_msg.hdr.length)
-                       break;
                dev_dbg(&dev->pdev->dev, "slots to read = %08x\n", slots);
                rets = mei_irq_read_handler(dev, &complete_list, &slots);
                if (rets && dev->dev_state != MEI_DEV_RESETTING) {
@@ -516,6 +513,8 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
                }
        }
 
+       dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
+
        rets = mei_irq_write_handler(dev, &complete_list);
 
        dev->hbuf_is_ready = mei_hbuf_is_ready(dev);