[patch -v2 10/23] ttusb: use simple_read_from_buffer()

From: akinobu . mita
Date: Sun Jun 01 2008 - 19:31:02 EST


Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
Cc: v4l-dvb-maintainer@xxxxxxxxxxx
---
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)

Index: 2.6-git/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
--- 2.6-git.orig/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ 2.6-git/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -19,6 +19,7 @@
#include <linux/errno.h>
#include <linux/jiffies.h>
#include <linux/mutex.h>
+#include <linux/fs.h>

#include "dvb_frontend.h"
#include "dmxdev.h"
@@ -983,22 +984,9 @@ static int stc_open(struct inode *inode,
}

static ssize_t stc_read(struct file *file, char *buf, size_t count,
- loff_t * offset)
+ loff_t *offset)
{
- int tc = count;
-
- if ((tc + *offset) > 8192)
- tc = 8192 - *offset;
-
- if (tc < 0)
- return 0;
-
- if (copy_to_user(buf, stc_firmware + *offset, tc))
- return -EFAULT;
-
- *offset += tc;
-
- return tc;
+ return simple_read_from_buffer(buf, count, offset, stc_firmware, 8192);
}

static int stc_release(struct inode *inode, struct file *file)

--
--
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/