summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinhyung Choi <jinhyung2.choi@samsung.com>2015-05-12 14:02:39 +0900
committerJinhyung Choi <jinhyung2.choi@samsung.com>2015-05-26 10:56:54 +0900
commitb893ae799be89de610bb71b983aba5e957a95078 (patch)
treeba75e523945369ae9fc6c14d1ce2eb9cdeb0024e
parent4fc167005e3b82ea728ef4952c42151e71543ebd (diff)
downloademulator-kernel-b893ae799be89de610bb71b983aba5e957a95078.tar.gz
emulator-kernel-b893ae799be89de610bb71b983aba5e957a95078.tar.bz2
emulator-kernel-b893ae799be89de610bb71b983aba5e957a95078.zip
sensor: split scatter list initialization
split in/out virtqueue scatterlist to set sg_mark_end each Change-Id: I562d51af7ab1d5e8b57b8971e7fe4d40d971a55b Signed-off-by: Jinhyung Choi <jinhyung2.choi@samsung.com>
-rw-r--r--drivers/maru/sensors/maru_virtio_sensor.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/maru/sensors/maru_virtio_sensor.c b/drivers/maru/sensors/maru_virtio_sensor.c
index fd7283e69a92..5d76a7ab0821 100644
--- a/drivers/maru/sensors/maru_virtio_sensor.c
+++ b/drivers/maru/sensors/maru_virtio_sensor.c
@@ -168,7 +168,7 @@ static void sensor_vq_done(struct virtqueue *rvq) {
mutex_lock(&vs->lock);
LOG(1, "msg buf: %s, req: %d, type: %d, vs->flags: %d", msg->buf, msg->req, msg->type, vs->flags);
- memset(sensor_data, 0, __MAX_BUF_SENSOR);
+ memset(sensor_data, 0, sizeof(sensor_data));
strcpy(sensor_data, msg->buf);
vs->flags = 1;
mutex_unlock(&vs->lock);
@@ -422,7 +422,6 @@ static void cleanup(struct virtio_device* dev) {
static int sensor_probe(struct virtio_device* dev)
{
int ret = 0;
- int index = 0;
char sensor_data[__MAX_BUF_SENSOR];
INFO("Sensor probe starts");
@@ -459,17 +458,15 @@ static int sensor_probe(struct virtio_device* dev)
virtqueue_enable_cb(vs->vq);
- sg_init_table(vs->sg_vq, 2);
- for (; index < 2; index++) {
- sg_set_buf(&vs->sg_vq[index], &vs->msginfo, sizeof(vs->msginfo));
- }
+ sg_init_one(&vs->sg_vq[0], &vs->msginfo, sizeof(vs->msginfo));
+ sg_init_one(&vs->sg_vq[1], &vs->msginfo, sizeof(vs->msginfo));
sg_init_one(vs->sg_svq, &vs->msginfo, sizeof(vs->msginfo));
mutex_init(&vs->lock);
mutex_init(&vs->vqlock);
- memset(sensor_data, 0, __MAX_BUF_SENSOR);
+ memset(sensor_data, 0, sizeof(sensor_data));
mutex_lock(&vs->vqlock);
ret = get_sensor_data(sensor_type_list, sensor_data);
mutex_unlock(&vs->vqlock);