tablet: added input buffer to virtqueue
authorsungmin ha <sungmin82.ha@samsung.com>
Thu, 30 Jul 2015 03:09:09 +0000 (12:09 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Thu, 30 Jul 2015 04:38:36 +0000 (13:38 +0900)
Change-Id: I279e54dba3405fc0659de93540e5066715f4762d
Signed-off-by: sungmin ha <sungmin82.ha@samsung.com>
drivers/maru/maru_virtio_tablet.c

index f13d632..db23b3f 100644 (file)
@@ -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;