Messages in this thread Patch in this message | | | Date | Wed, 04 Jun 2008 20:56:46 +0900 | From | Akinobu Mita <> | Subject | [patch -v3 13/22] dcdbas: use memory_read_from_buffer |
| |
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Doug Warzecha <Douglas_Warzecha@dell.com> --- drivers/firmware/dcdbas.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
Index: 2.6-git/drivers/firmware/dcdbas.c =================================================================== --- 2.6-git.orig/drivers/firmware/dcdbas.c +++ 2.6-git/drivers/firmware/dcdbas.c @@ -34,6 +34,7 @@ #include <linux/string.h> #include <linux/types.h> #include <linux/mutex.h> +#include <linux/fs.h> #include <asm/io.h> #include "dcdbas.h" @@ -152,20 +153,11 @@ static ssize_t smi_data_read(struct 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; } --
| |