]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] usbvision: cleanup the code
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 5 Jun 2015 13:47:36 +0000 (10:47 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 5 Jun 2015 14:26:47 +0000 (11:26 -0300)
There's a dead code on usbvision that makes it harder to read
and produces a smatch warning about bad identation.

Improve the code readability and add a FIXME to warn about
the current hack there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/usbvision/usbvision-video.c

index 12b403e78d5212b9d1710c6b9dd3bdca30dfaccb..1c6d31f7c1b9af88103c78687560e47480b17a24 100644 (file)
@@ -1061,13 +1061,24 @@ static ssize_t usbvision_read(struct file *file, char __user *buf,
               __func__,
               (unsigned long)count, frame->bytes_read);
 
-       /* For now, forget the frame if it has not been read in one shot. */
-/*     if (frame->bytes_read >= frame->scanlength) {*/ /* All data has been read */
+#if 1
+       /*
+        * FIXME:
+        * For now, forget the frame if it has not been read in one shot.
+        */
+       frame->bytes_read = 0;
+
+       /* Mark it as available to be used again. */
+       frame->grabstate = frame_state_unused;
+#else
+       if (frame->bytes_read >= frame->scanlength) {
+               /* All data has been read */
                frame->bytes_read = 0;
 
                /* Mark it as available to be used again. */
                frame->grabstate = frame_state_unused;
-/*     } */
+       }
+#endif
 
        return count;
 }