Skip to content

Commit

Permalink
dcdbas: use memory_read_from_buffer()
Browse files Browse the repository at this point in the history
Signed-off-by: Akinobu Mita <[email protected]>
Cc: Doug Warzecha <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Matt Domsch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mita authored and torvalds committed Jul 25, 2008
1 parent f37e661 commit abe19b7
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions drivers/firmware/dcdbas.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,11 @@ static ssize_t smi_data_read(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{
size_t max_read;
ssize_t ret;

mutex_lock(&smi_data_lock);

if (pos >= smi_data_buf_size) {
ret = 0;
goto out;
}

max_read = smi_data_buf_size - pos;
ret = min(max_read, count);
memcpy(buf, smi_data_buf + pos, ret);
out:
ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf,
smi_data_buf_size);
mutex_unlock(&smi_data_lock);
return ret;
}
Expand Down

0 comments on commit abe19b7

Please sign in to comment.