From a897df41982540c720534e581c322d78070cd965 Mon Sep 17 00:00:00 2001 From: Jinhyung Jo Date: Tue, 23 Feb 2016 14:28:43 +0900 Subject: [PATCH] maru_inputs: correct argument for virtioqueue The fourth argument of the virtqueue_add_inbuf() is a 'data' token handled to virtqueue_get_buf(). So change to clear targets instead of constant values typecasted. Change-Id: Ibc3aef906568cff4e9a2b809d72c1eb0c15b73cf Signed-off-by: Jinhyung Jo (cherry picked from commit 8a5e857387d3e1106c22f239e7f898658c01dbc2) --- drivers/maru/maru_virtio_hwkey.c | 2 +- drivers/maru/maru_virtio_keyboard.c | 4 ++-- drivers/maru/maru_virtio_rotary.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/maru/maru_virtio_hwkey.c b/drivers/maru/maru_virtio_hwkey.c index 77c83f8..03f30eb 100644 --- a/drivers/maru/maru_virtio_hwkey.c +++ b/drivers/maru/maru_virtio_hwkey.c @@ -197,7 +197,7 @@ static int virtio_hwkey_probe(struct virtio_device *vdev) } err = virtqueue_add_inbuf(vh->vq, vh->sg, - MAX_BUF_COUNT, (void *)MAX_BUF_COUNT, GFP_ATOMIC); + MAX_BUF_COUNT, (void *)vh->vbuf, GFP_ATOMIC); /* register for input device */ vh->idev = input_allocate_device(); diff --git a/drivers/maru/maru_virtio_keyboard.c b/drivers/maru/maru_virtio_keyboard.c index 7396442..f318ef1 100644 --- a/drivers/maru/maru_virtio_keyboard.c +++ b/drivers/maru/maru_virtio_keyboard.c @@ -106,7 +106,7 @@ static void vq_keyboard_handle(struct virtqueue *vq) vqidx = 0; } } - err = virtqueue_add_inbuf(vq, vkbd->sg, KBD_BUF_SIZE, (void *)KBD_BUF_SIZE, GFP_ATOMIC); + err = virtqueue_add_inbuf(vq, vkbd->sg, KBD_BUF_SIZE, (void *)vkbd->kbdevt, GFP_ATOMIC); if (err < 0) { VKBD_LOG(KERN_ERR, "failed to add buffer to virtqueue.\n"); return; @@ -177,7 +177,7 @@ static int virtio_keyboard_probe(struct virtio_device *vdev) sizeof(struct EmulKbdEvent)); } - ret = virtqueue_add_inbuf(vkbd->vq, vkbd->sg, KBD_BUF_SIZE, (void *)KBD_BUF_SIZE, GFP_ATOMIC); + ret = virtqueue_add_inbuf(vkbd->vq, vkbd->sg, KBD_BUF_SIZE, (void *)vkbd->kbdevt, GFP_ATOMIC); if (ret < 0) { VKBD_LOG(KERN_ERR, "failed to add buffer to virtqueue.\n"); kfree(vkbd); diff --git a/drivers/maru/maru_virtio_rotary.c b/drivers/maru/maru_virtio_rotary.c index ad904c6..bdbbd9c 100644 --- a/drivers/maru/maru_virtio_rotary.c +++ b/drivers/maru/maru_virtio_rotary.c @@ -157,7 +157,7 @@ static void vq_rotary_handler(struct virtqueue *vq) err = virtqueue_add_inbuf(vq, vrtr->sg, ROTARY_BUF_SIZE, - (void *)ROTARY_BUF_SIZE, + (void *)vrtr->event, GFP_ATOMIC); if (err < 0) { VR_LOG(KERN_ERR, "failed to add buffer to virtqueue\n"); @@ -214,7 +214,7 @@ static int virtio_rotary_probe(struct virtio_device *vdev) ret = virtqueue_add_inbuf(vrtr->vq, vrtr->sg, ROTARY_BUF_SIZE, - (void *)ROTARY_BUF_SIZE, + (void *)vrtr->event, GFP_ATOMIC); /* register for input device */ -- 2.7.4