From d473f1b0df3a92724f40e8a7c1c150a7a8af1fa0 Mon Sep 17 00:00:00 2001 From: Munkyu Im Date: Thu, 17 Nov 2016 19:02:07 +0900 Subject: [PATCH] virtio: wake up interrupt after all messages are added 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 (cherry picked from commit 28efc5cf7353c64fb3da97a3d51020769db86ba5) --- drivers/maru/maru_virtio_evdi.c | 5 +---- drivers/maru/maru_virtio_nfc.c | 4 ++-- drivers/maru/maru_virtio_vmodem.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/maru/maru_virtio_evdi.c b/drivers/maru/maru_virtio_evdi.c index 87477507a3d3..74e8d3613ed5 100644 --- a/drivers/maru/maru_virtio_evdi.c +++ b/drivers/maru/maru_virtio_evdi.c @@ -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) diff --git a/drivers/maru/maru_virtio_nfc.c b/drivers/maru/maru_virtio_nfc.c index 274ba879afe3..afa68a24a188 100644 --- a/drivers/maru/maru_virtio_nfc.c +++ b/drivers/maru/maru_virtio_nfc.c @@ -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) { diff --git a/drivers/maru/maru_virtio_vmodem.c b/drivers/maru/maru_virtio_vmodem.c index 1acea48fd8dc..2e864edb628f 100644 --- a/drivers/maru/maru_virtio_vmodem.c +++ b/drivers/maru/maru_virtio_vmodem.c @@ -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) { -- 2.34.1