[patch -v3 13/22] dcdbas: use memory_read_from_buffer

From: Akinobu Mita
Date: Wed Jun 04 2008 - 08:14:25 EST


Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
Cc: Doug Warzecha <Douglas_Warzecha@xxxxxxxx>
---
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;
}

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/