From: Akinobu Mita Date: Fri, 25 Jul 2008 08:48:24 +0000 (-0700) Subject: dcdbas: use memory_read_from_buffer() X-Git-Tag: v2.6.27-rc1~287 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=abe19b7b822a8fdbe3dbfd6e066d0698b4eefb06;p=linux-2.6-omap-h63xx.git dcdbas: use memory_read_from_buffer() Signed-off-by: Akinobu Mita Cc: Doug Warzecha Cc: Zhang Rui Cc: Matt Domsch Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 0b624e927a6..c66817e7717 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; }