summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/bus.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2015-02-10 09:39:43 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-02 04:37:00 +0100
commitbca67d681c4864b74fa5fae9ee47e562d1e272b1 (patch)
tree1538db82496b44cc2f7343714ed4a949311f1815 /drivers/misc/mei/bus.c
parentmei: use only one buffer in callback (diff)
downloadlinux-bca67d681c4864b74fa5fae9ee47e562d1e272b1.tar.xz
linux-bca67d681c4864b74fa5fae9ee47e562d1e272b1.zip
mei: always initialize the callback with the intended operation type
We set the operation type at initialization time as each cb is used only for a single type of operation As a byproduct we add a convenient wrapper for allocating cb with the data buffer. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/bus.c')
-rw-r--r--drivers/misc/mei/bus.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 36b949a0fddb..3e6ffed9402a 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -255,16 +255,12 @@ static ssize_t ___mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
goto out;
}
- cb = mei_io_cb_init(cl, NULL);
+ cb = mei_cl_alloc_cb(cl, length, MEI_FOP_WRITE, NULL);
if (!cb) {
rets = -ENOMEM;
goto out;
}
- rets = mei_io_cb_alloc_buf(cb, length);
- if (rets < 0)
- goto out;
-
memcpy(cb->buf.data, buf, length);
rets = mei_cl_write(cl, cb, blocking);
@@ -293,7 +289,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
mutex_lock(&dev->device_lock);
if (!cl->read_cb) {
- rets = mei_cl_read_start(cl, length);
+ rets = mei_cl_read_start(cl, length, NULL);
if (rets < 0)
goto out;
}
@@ -392,7 +388,7 @@ static void mei_bus_event_work(struct work_struct *work)
device->events = 0;
/* Prepare for the next read */
- mei_cl_read_start(device->cl, 0);
+ mei_cl_read_start(device->cl, 0, NULL);
}
int mei_cl_register_event_cb(struct mei_cl_device *device,
@@ -406,7 +402,7 @@ int mei_cl_register_event_cb(struct mei_cl_device *device,
device->event_context = context;
INIT_WORK(&device->event_work, mei_bus_event_work);
- mei_cl_read_start(device->cl, 0);
+ mei_cl_read_start(device->cl, 0, NULL);
return 0;
}
@@ -448,7 +444,7 @@ int mei_cl_enable_device(struct mei_cl_device *device)
mutex_unlock(&dev->device_lock);
if (device->event_cb && !cl->read_cb)
- mei_cl_read_start(device->cl, 0);
+ mei_cl_read_start(device->cl, 0, NULL);
if (!device->ops || !device->ops->enable)
return 0;