virtio: wake up interrupt after all messages are added
authorMunkyu Im <munkyu.im@samsung.com>
Thu, 17 Nov 2016 10:02:07 +0000 (19:02 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Tue, 22 Nov 2016 10:32:38 +0000 (19:32 +0900)
In case of using multiple message with list,
wake up interrupt should call after all messages are added to list.
Otherwise, synchronization problem can be occurred.

Change-Id: I808f54d8d08267e8038e6fe17187abaaa10edf56
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
(cherry picked from commit 28efc5cf7353c64fb3da97a3d51020769db86ba5)

drivers/maru/maru_virtio_evdi.c
drivers/maru/maru_virtio_nfc.c
drivers/maru/maru_virtio_vmodem.c

index 87477507a3d382f0ca42e9c4d6db1893adfa23de..74e8d3613ed58c31bd4ef5f13ed1a6ad62c5707a 100644 (file)
@@ -430,8 +430,6 @@ static void evdi_recv_done(struct virtqueue *rvq) {
        struct msg_info* _msg;
        struct msg_buf* msgbuf;
 
-
-
        /* TODO : check if guest has been connected. */
 
        _msg = (struct msg_info*) virtqueue_get_buf(vevdi->rvq, &len);
@@ -458,8 +456,6 @@ static void evdi_recv_done(struct virtqueue *rvq) {
 
                spin_unlock_irqrestore(&pevdi_info[EVID_READ]->inbuf_lock, flags);
 
-               wake_up_interruptible(&pevdi_info[EVID_READ]->waitqueue);
-
                _msg = (struct msg_info*) virtqueue_get_buf(vevdi->rvq, &len);
                if (_msg == NULL) {
                        break;
@@ -467,6 +463,7 @@ static void evdi_recv_done(struct virtqueue *rvq) {
 
        } while (true);
 
+       wake_up_interruptible(&pevdi_info[EVID_READ]->waitqueue);
 
        /*
        if (add_inbuf(vevdi->rvq, &vevdi->read_msginfo) < 0)
index 274ba879afe397adc1d713a12f921000326db15a..afa68a24a188cf2738ffbc52663dd7cd59cef2d3 100644 (file)
@@ -377,14 +377,14 @@ static void nfc_recv_done(struct virtqueue *rvq) {
 
                spin_unlock_irqrestore(&pnfc_info[NFC_READ]->inbuf_lock, flags);
 
-               wake_up_interruptible(&pnfc_info[NFC_READ]->waitqueue);
-
                msg = (unsigned char*) virtqueue_get_buf(vnfc->rvq, &len);
                if (msg == NULL) {
                        break;
                }
 
        } while (true);
+
+       wake_up_interruptible(&pnfc_info[NFC_READ]->waitqueue);
        /*
           if (add_inbuf(vnfc->rvq, &vnfc->readmsginfo) < 0)
           {
index 1acea48fd8dc6fc77ab3b767075e46f97bae6b44..2e864edb628f383fab1ffea51843e4014cef7368 100644 (file)
@@ -370,14 +370,14 @@ static void vmodem_recv_done(struct virtqueue *rvq) {
 
                spin_unlock_irqrestore(&pvmodem_info[EVID_READ]->inbuf_lock, flags);
 
-               wake_up_interruptible(&pvmodem_info[EVID_READ]->waitqueue);
-
                _msg = (struct msg_info*) virtqueue_get_buf(vvmodem->rvq, &len);
                if (_msg == NULL) {
                        break;
                }
 
        } while (true);
+
+       wake_up_interruptible(&pvmodem_info[EVID_READ]->waitqueue);
 }
 
 static void vmodem_send_done(struct virtqueue *svq) {