From dbb15ac0adcf65113e4637c71362f46b6f79674b Mon Sep 17 00:00:00 2001 From: sungmin ha Date: Thu, 30 Jul 2015 12:09:09 +0900 Subject: [PATCH] tablet: added input buffer to virtqueue Change-Id: I279e54dba3405fc0659de93540e5066715f4762d Signed-off-by: sungmin ha --- drivers/maru/maru_virtio_tablet.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/maru/maru_virtio_tablet.c b/drivers/maru/maru_virtio_tablet.c index f13d632..db23b3f 100644 --- a/drivers/maru/maru_virtio_tablet.c +++ b/drivers/maru/maru_virtio_tablet.c @@ -99,6 +99,8 @@ static unsigned int index = 0; static void vq_tablet_callback(struct virtqueue *vq) { struct EmulTabletEvent tablet_event; + unsigned int len = 0; + void *token = NULL; while (1) { memcpy(&tablet_event, &vtb->vbuf[vqidx], @@ -132,6 +134,19 @@ static void vq_tablet_callback(struct virtqueue *vq) memset(&vtb->vbuf[vqidx], 0x00, sizeof(tablet_event)); + token = virtqueue_get_buf(vtb->vq, &len); + if (!token) { + printk(KERN_ERR "failed to virtqueue_get_buf\n"); + return; + } + + err = virtqueue_add_inbuf(vtb->vq, vtb->sg, + MAX_BUF_COUNT, token, GFP_ATOMIC); + if (err < 0) { + printk(KERN_ERR "failed to add buffer to virtqueue\n"); + return; + } + vqidx++; if (vqidx == MAX_BUF_COUNT) { vqidx = 0; -- 2.7.4