V4L/DVB: drivers/media/video: Adjust confusing if indentation
authorJulia Lawall <julia@diku.dk>
Thu, 5 Aug 2010 20:22:44 +0000 (17:22 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:04:48 +0000 (01:04 -0200)
In cx23885/cx23885-video.c, cx88/cx88-video.c, davinci/vpif_capture.c, and
davinci/vpif_display.c, group the aligned code into a single if branch.

In saa7134/saa7134-video.c, outdent the code following the if.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@

(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

if (p1[0].column == p2[0].column):
  cocci.print_main("branch",p1)
  cocci.print_secs("after",p2)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/davinci/vpif_capture.c
drivers/media/video/davinci/vpif_display.c
drivers/media/video/saa7134/saa7134-video.c

index da66e5f8d91d1c40d60042d14bdd3c8f4cb21b36..5aadc1d1956e73213cb95dae7aefd16e0aa4a887 100644 (file)
@@ -1165,9 +1165,10 @@ static int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
        i->type  = V4L2_INPUT_TYPE_CAMERA;
        strcpy(i->name, iname[INPUT(n)->type]);
        if ((CX23885_VMUX_TELEVISION == INPUT(n)->type) ||
-               (CX23885_VMUX_CABLE == INPUT(n)->type))
+               (CX23885_VMUX_CABLE == INPUT(n)->type)) {
                i->type = V4L2_INPUT_TYPE_TUNER;
                i->std = CX23885_NORMS;
+       }
        return 0;
 }
 
index 0fab65c3ab392c6293b7393821e548bea4391b25..4fba913edb1ba8a0803c0c2842bc6aa8b0ad9bae 100644 (file)
@@ -1267,9 +1267,10 @@ int cx88_enum_input (struct cx88_core  *core,struct v4l2_input *i)
        i->type  = V4L2_INPUT_TYPE_CAMERA;
        strcpy(i->name,iname[INPUT(n).type]);
        if ((CX88_VMUX_TELEVISION == INPUT(n).type) ||
-           (CX88_VMUX_CABLE      == INPUT(n).type))
+           (CX88_VMUX_CABLE      == INPUT(n).type)) {
                i->type = V4L2_INPUT_TYPE_TUNER;
                i->std = CX88_NORMS;
+       }
        return 0;
 }
 EXPORT_SYMBOL(cx88_enum_input);
index a7f48b53d3fc5aac3ac1cc48c770d6061e3ff8f4..2b424731f133dc0cf92941fc5d84ab93d5e51c40 100644 (file)
@@ -1030,9 +1030,10 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
                        goto qbuf_exit;
 
                if ((VIDEOBUF_NEEDS_INIT != buf1->state)
-                           && (buf1->baddr != tbuf.m.userptr))
+                           && (buf1->baddr != tbuf.m.userptr)) {
                        vpif_buffer_release(&common->buffer_queue, buf1);
                        buf1->baddr = tbuf.m.userptr;
+               }
                break;
 
        default:
index da07607cbc55859a2286f36afd254ae0f7e90595..4770fda3a19917013d5fc78335f364a580b62fdd 100644 (file)
@@ -935,9 +935,10 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
                        goto qbuf_exit;
 
                if ((VIDEOBUF_NEEDS_INIT != buf1->state)
-                           && (buf1->baddr != tbuf.m.userptr))
+                           && (buf1->baddr != tbuf.m.userptr)) {
                        vpif_buffer_release(&common->buffer_queue, buf1);
                        buf1->baddr = tbuf.m.userptr;
+               }
                break;
 
        default:
index 45f0ac8f3c0f88dcf877041cd364535450ff2638..645224cfd887afed25cc949511d3e591cba88a31 100644 (file)
@@ -1825,7 +1825,7 @@ static int saa7134_querycap(struct file *file, void  *priv,
 
        if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET))
                cap->capabilities &= ~V4L2_CAP_TUNER;
-               return 0;
+       return 0;
 }
 
 int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id *id)