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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: <v4l-dvb-maintainer@...>
Date: Sunday, June 1, 2008 - 7:13 pm

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: v4l-dvb-maintainer@linuxtv.org
---
 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)

-- 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch -v2 10/23] ttusb: use simple_read_from_buffer(), , (Sun Jun 1, 7:13 pm)