Commit 3e17e39e authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: style changes in easycap_low.c

remove uneedet brackets in ifs and switches
drop pointless castings
other small fixes

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Reviewed-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ccb6d2e5
...@@ -145,7 +145,7 @@ static const struct stk1160config stk1160configNTSC[256] = { ...@@ -145,7 +145,7 @@ static const struct stk1160config stk1160configNTSC[256] = {
{0xFFF, 0xFFFF} {0xFFF, 0xFFFF}
}; };
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
static const struct saa7113config{ static const struct saa7113config {
int reg; int reg;
int set; int set;
} saa7113configPAL[256] = { } saa7113configPAL[256] = {
...@@ -600,10 +600,7 @@ int merit_saa(struct usb_device *p) ...@@ -600,10 +600,7 @@ int merit_saa(struct usb_device *p)
if (NULL == p) if (NULL == p)
return -ENODEV; return -ENODEV;
rc = read_saa(p, 0x1F); rc = read_saa(p, 0x1F);
if ((0 > rc) || (0x02 & rc)) return ((0 > rc) || (0x02 & rc)) ? 1 : 0;
return 1 ;
else
return 0;
} }
/****************************************************************************/ /****************************************************************************/
int ready_saa(struct usb_device *p) int ready_saa(struct usb_device *p)
...@@ -785,28 +782,28 @@ select_input(struct usb_device *p, int input, int mode) ...@@ -785,28 +782,28 @@ select_input(struct usb_device *p, int input, int mode)
switch (input) { switch (input) {
case 0: case 0:
case 1: { case 1: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80))
SAY("ERROR: failed to set SAA register 0x02 " SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input); "for input %i\n", input);
}
SET(p, 0x0000, 0x0098); SET(p, 0x0000, 0x0098);
SET(p, 0x0002, 0x0078); SET(p, 0x0002, 0x0078);
break; break;
} }
case 2: { case 2: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80))
SAY("ERROR: failed to set SAA register 0x02 " SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input); "for input %i\n", input);
}
SET(p, 0x0000, 0x0090); SET(p, 0x0000, 0x0090);
SET(p, 0x0002, 0x0078); SET(p, 0x0002, 0x0078);
break; break;
} }
case 3: { case 3: {
if (0 != write_saa(p, 0x02, 0x80)) { if (0 != write_saa(p, 0x02, 0x80))
SAY("ERROR: failed to set SAA register 0x02 " SAY("ERROR: failed to set SAA register 0x02 "
" for input %i\n", input); " for input %i\n", input);
}
SET(p, 0x0000, 0x0088); SET(p, 0x0000, 0x0088);
SET(p, 0x0002, 0x0078); SET(p, 0x0002, 0x0078);
break; break;
...@@ -825,48 +822,48 @@ select_input(struct usb_device *p, int input, int mode) ...@@ -825,48 +822,48 @@ select_input(struct usb_device *p, int input, int mode)
mode = 7; mode = 7;
switch (mode) { switch (mode) {
case 7: { case 7: {
if (0 != write_saa(p, 0x02, 0x87)) { if (0 != write_saa(p, 0x02, 0x87))
SAY("ERROR: failed to set SAA register 0x02 " SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input); "for input %i\n", input);
}
if (0 != write_saa(p, 0x05, 0xFF)) { if (0 != write_saa(p, 0x05, 0xFF))
SAY("ERROR: failed to set SAA register 0x05 " SAY("ERROR: failed to set SAA register 0x05 "
"for input %i\n", input); "for input %i\n", input);
}
break; break;
} }
case 9: { case 9: {
if (0 != write_saa(p, 0x02, 0x89)) { if (0 != write_saa(p, 0x02, 0x89))
SAY("ERROR: failed to set SAA register 0x02 " SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input); "for input %i\n", input);
}
if (0 != write_saa(p, 0x05, 0x00)) { if (0 != write_saa(p, 0x05, 0x00))
SAY("ERROR: failed to set SAA register 0x05 " SAY("ERROR: failed to set SAA register 0x05 "
"for input %i\n", input); "for input %i\n", input);
}
break; break;
} }
default: { default:
SAY("MISTAKE: bad mode: %i\n", mode); SAY("MISTAKE: bad mode: %i\n", mode);
return -1; return -1;
} }
}
if (0 != write_saa(p, 0x04, 0x00)) { if (0 != write_saa(p, 0x04, 0x00))
SAY("ERROR: failed to set SAA register 0x04 " SAY("ERROR: failed to set SAA register 0x04 "
"for input %i\n", input); "for input %i\n", input);
}
if (0 != write_saa(p, 0x09, 0x80)) { if (0 != write_saa(p, 0x09, 0x80))
SAY("ERROR: failed to set SAA register 0x09 " SAY("ERROR: failed to set SAA register 0x09 "
"for input %i\n", input); "for input %i\n", input);
}
SET(p, 0x0002, 0x0093); SET(p, 0x0002, 0x0093);
break; break;
} }
default: { default:
SAY("ERROR: bad input: %i\n", input); SAY("ERROR: bad input: %i\n", input);
return -1; return -1;
} }
}
ir = read_stk(p, 0x00); ir = read_stk(p, 0x00);
JOT(8, "STK register 0x00 has 0x%02X\n", ir); JOT(8, "STK register 0x00 has 0x%02X\n", ir);
ir = read_saa(p, 0x02); ir = read_saa(p, 0x02);
...@@ -952,21 +949,19 @@ int wait_i2c(struct usb_device *p) ...@@ -952,21 +949,19 @@ int wait_i2c(struct usb_device *p)
if (NULL == p) if (NULL == p)
return -ENODEV; return -ENODEV;
for (k = 0; k < max; k++) { for (k = 0; k < max; k++) {
GET(p, 0x0201, &igot); get0 = igot; GET(p, 0x0201, &igot); get0 = igot;
switch (get0) { switch (get0) {
case 0x04: case 0x04:
case 0x01: { case 0x01:
return 0; return 0;
} case 0x00:
case 0x00: {
msleep(20); msleep(20);
continue; continue;
} default:
default: {
return get0 - 1; return get0 - 1;
} }
}
} }
return -1; return -1;
} }
...@@ -977,20 +972,17 @@ int wakeup_device(struct usb_device *pusb_device) ...@@ -977,20 +972,17 @@ int wakeup_device(struct usb_device *pusb_device)
if (!pusb_device) if (!pusb_device)
return -ENODEV; return -ENODEV;
return usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), return usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(u8)USB_REQ_SET_FEATURE, USB_REQ_SET_FEATURE,
USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
USB_DEVICE_REMOTE_WAKEUP, USB_DEVICE_REMOTE_WAKEUP,
(u16)0, 0, NULL, 0, 50000);
(void *) NULL,
(u16)0,
(int)50000);
} }
/*****************************************************************************/ /*****************************************************************************/
int int
audio_setup(struct easycap *peasycap) audio_setup(struct easycap *peasycap)
{ {
struct usb_device *pusb_device; struct usb_device *pusb_device;
unsigned char buffer[1]; u8 buffer[1];
int rc, id1, id2; int rc, id1, id2;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -1027,26 +1019,19 @@ audio_setup(struct easycap *peasycap) ...@@ -1027,26 +1019,19 @@ audio_setup(struct easycap *peasycap)
buffer[0] = 0x01; buffer[0] = 0x01;
rc = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), rc = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(u8)request, request, requesttype, value_unmute,
(u8)requesttype, index, &buffer[0], length, 50000);
(u16)value_unmute,
(u16)index, JOT(8, "0x%02X=buffer\n", buffer[0]);
(void *)&buffer[0],
(u16)length,
(int)50000);
JOT(8, "0x%02X=buffer\n", *((u8 *) &buffer[0]));
if (rc != (int)length) { if (rc != (int)length) {
switch (rc) { switch (rc) {
case -EPIPE: { case -EPIPE:
SAY("usb_control_msg returned -EPIPE\n"); SAY("usb_control_msg returned -EPIPE\n");
break; break;
} default:
default: {
SAY("ERROR: usb_control_msg returned %i\n", rc); SAY("ERROR: usb_control_msg returned %i\n", rc);
break; break;
} }
}
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment