[media] gspca - ov519: Simplify the LED control functions
authorJean-François Moine <moinejf@free.fr>
Fri, 12 Nov 2010 18:07:35 +0000 (15:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 29 Dec 2010 10:16:43 +0000 (08:16 -0200)
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/ov519.c

index d60322047265423375b02f61ea360c9ebb3f4b2d..2484e5222d4a5c5b73a27cf8bf2dfe21b6d5cce5 100644 (file)
@@ -2639,14 +2639,14 @@ static void ov51x_led_control(struct sd *sd, int on)
        switch (sd->bridge) {
        /* OV511 has no LED control */
        case BRIDGE_OV511PLUS:
-               reg_w(sd, R511_SYS_LED_CTL, on ? 1 : 0);
+               reg_w(sd, R511_SYS_LED_CTL, on);
                break;
        case BRIDGE_OV518:
        case BRIDGE_OV518PLUS:
-               reg_w_mask(sd, R518_GPIO_OUT, on ? 0x02 : 0x00, 0x02);
+               reg_w_mask(sd, R518_GPIO_OUT, 0x02 * on, 0x02);
                break;
        case BRIDGE_OV519:
-               reg_w_mask(sd, OV519_GPIO_DATA_OUT0, !on, 1);   /* 0 / 1 */
+               reg_w_mask(sd, OV519_GPIO_DATA_OUT0, on, 1);
                break;
        }
 }
@@ -2938,7 +2938,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam = &gspca_dev->cam;
 
        sd->bridge = id->driver_info & BRIDGE_MASK;
-       sd->invert_led = id->driver_info & BRIDGE_INVERT_LED;
+       sd->invert_led = (id->driver_info & BRIDGE_INVERT_LED) != 0;
 
        switch (sd->bridge) {
        case BRIDGE_OV511: