V4L/DVB (8251): ttusb: use simple_read_from_buffer()()
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 4 Jul 2008 09:33:20 +0000 (06:33 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 20 Jul 2008 10:19:04 +0000 (07:19 -0300)
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c

index 1560722..e6c9cd2 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/wait.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/usb.h>
 #include <linux/delay.h>
@@ -990,22 +991,9 @@ static int stc_open(struct inode *inode, struct file *file)
 }
 
 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)