Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363223
b: refs/heads/master
c: fcb136e
h: refs/heads/master
i:
  363221: 0da6444
  363219: 6324b13
  363215: 2040797
v: v3
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Apr 19, 2013
1 parent a8a8904 commit 66f2268
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e0f180fd8b47fa0884177a142e41a86117edc23
refs/heads/master: fcb136e1ac5774909e0d85189f721b8dfa800e0f
8 changes: 4 additions & 4 deletions trunk/drivers/misc/mei/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ int __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
mutex_lock(&dev->device_lock);

if (!cl->read_cb) {
err = mei_cl_read_start(cl);
err = mei_cl_read_start(cl, length);
if (err < 0) {
mutex_unlock(&dev->device_lock);
return err;
Expand Down Expand Up @@ -378,7 +378,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);
mei_cl_read_start(device->cl, 0);
}

int mei_cl_register_event_cb(struct mei_cl_device *device,
Expand All @@ -392,7 +392,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);
mei_cl_read_start(device->cl, 0);

return 0;
}
Expand Down Expand Up @@ -436,7 +436,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);
mei_cl_read_start(device->cl, 0);

if (!device->ops || !device->ops->enable)
return 0;
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/misc/mei/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl)
*
* returns 0 on success, <0 on failure.
*/
int mei_cl_read_start(struct mei_cl *cl)
int mei_cl_read_start(struct mei_cl *cl, size_t length)
{
struct mei_device *dev;
struct mei_cl_cb *cb;
Expand Down Expand Up @@ -657,8 +657,9 @@ int mei_cl_read_start(struct mei_cl *cl)
if (!cb)
return -ENOMEM;

rets = mei_io_cb_alloc_resp_buf(cb,
dev->me_clients[i].props.max_msg_length);
/* always allocate at least client max message */
length = max_t(size_t, length, dev->me_clients[i].props.max_msg_length);
rets = mei_io_cb_alloc_resp_buf(cb, length);
if (rets)
goto err;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/misc/mei/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl);
bool mei_cl_is_other_connecting(struct mei_cl *cl);
int mei_cl_disconnect(struct mei_cl *cl);
int mei_cl_connect(struct mei_cl *cl, struct file *file);
int mei_cl_read_start(struct mei_cl *cl);
int mei_cl_read_start(struct mei_cl *cl, size_t length);
int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking);

void mei_host_client_init(struct work_struct *work);
Expand Down
18 changes: 15 additions & 3 deletions trunk/drivers/misc/mei/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,21 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
}

if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) {
dev_warn(&dev->pdev->dev, "message overflow.\n");
list_del(&cb->list);
return -ENOMEM;
dev_dbg(&dev->pdev->dev, "message overflow. size %d len %d idx %ld\n",
cb->response_buffer.size,
mei_hdr->length, cb->buf_idx);
cb->response_buffer.data =
krealloc(cb->response_buffer.data,
mei_hdr->length + cb->buf_idx,
GFP_KERNEL);

if (!cb->response_buffer.data) {
dev_err(&dev->pdev->dev, "allocation failed.\n");
list_del(&cb->list);
return -ENOMEM;
}
cb->response_buffer.size =
mei_hdr->length + cb->buf_idx;
}

buffer = cb->response_buffer.data + cb->buf_idx;
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/misc/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
goto out;
}

err = mei_cl_read_start(cl);
err = mei_cl_read_start(cl, length);
if (err && err != -EBUSY) {
dev_dbg(&dev->pdev->dev,
"mei start read failure with status = %d\n", err);
Expand Down Expand Up @@ -292,9 +292,8 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
}
/* now copy the data to user space */
copy_buffer:
dev_dbg(&dev->pdev->dev, "cb->response_buffer size - %d\n",
cb->response_buffer.size);
dev_dbg(&dev->pdev->dev, "cb->buf_idx - %lu\n", cb->buf_idx);
dev_dbg(&dev->pdev->dev, "buf.size = %d buf.idx= %ld\n",
cb->response_buffer.size, cb->buf_idx);
if (length == 0 || ubuf == NULL || *offset > cb->buf_idx) {
rets = -EMSGSIZE;
goto free;
Expand Down

0 comments on commit 66f2268

Please sign in to comment.