summaryrefslogtreecommitdiffstats
path: root/drivers/firmware/dcdbas.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-07-25 01:48:24 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 10:53:44 -0700
commitabe19b7b822a8fdbe3dbfd6e066d0698b4eefb06 (patch)
tree1b0ec57d3716c12c87502127bc34900777bd02b7 /drivers/firmware/dcdbas.c
parentf37e66173e0cc09b4e5a89eb0294abbefc15f435 (diff)
downloadop-kernel-dev-abe19b7b822a8fdbe3dbfd6e066d0698b4eefb06.zip
op-kernel-dev-abe19b7b822a8fdbe3dbfd6e066d0698b4eefb06.tar.gz
dcdbas: use memory_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Doug Warzecha <Douglas_Warzecha@dell.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Matt Domsch <Matt_Domsch@dell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/firmware/dcdbas.c')
-rw-r--r--drivers/firmware/dcdbas.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 0b624e9..c66817e 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -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;
}
OpenPOWER on IntegriCloud