V4L/DVB (9079): gspca: Return error code from stream start functions.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Jean-Francois Moine 2008-09-20 06:39:08 -03:00 committed by Mauro Carvalho Chehab
parent 1b60e1adc7
commit 72ab97cecb
22 changed files with 60 additions and 34 deletions

View File

@ -837,12 +837,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
cx11646_initsize(gspca_dev);
cx11646_fw(gspca_dev);
cx_sensor(gspca_dev);
cx11646_jpeg(gspca_dev);
return 0;
}
static void sd_stop0(struct gspca_dev *gspca_dev)

View File

@ -691,7 +691,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -704,6 +704,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev, ET_RESET_ALL, 0x08);
et_video(gspca_dev, 1); /* video on */
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -584,7 +584,11 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
goto out;
/* start the cam */
gspca_dev->sd_desc->start(gspca_dev);
ret = gspca_dev->sd_desc->start(gspca_dev);
if (ret < 0) {
destroy_urbs(gspca_dev);
goto out;
}
gspca_dev->streaming = 1;
atomic_set(&gspca_dev->nevent, 0);

View File

@ -93,7 +93,7 @@ struct sd_desc {
/* mandatory operations */
cam_cf_op config; /* called on probe */
cam_op init; /* called on probe and resume */
cam_v_op start; /* called on stream on */
cam_op start; /* called on stream on */
cam_pkt_op pkt_scan;
/* optional operations */
cam_v_op stopN; /* called on stream off - main alt */

View File

@ -134,7 +134,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
int err_code;
__u8 *data;
@ -143,9 +143,10 @@ static void sd_start(struct gspca_dev *gspca_dev)
int intpipe;
PDEBUG(D_STREAM, "camera start, iface %d, alt 8", gspca_dev->iface);
if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 8) < 0) {
err_code = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 8);
if (err_code < 0) {
PDEBUG(D_ERR|D_STREAM, "Set packet size: set interface error");
return;
return err_code;
}
data = gspca_dev->usb_buf;
@ -154,7 +155,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
err_code = reg_w(gspca_dev, data[0], 2);
if (err_code < 0)
return;
return err_code;
/*
Initialize the MR97113 chip register
@ -180,14 +181,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
err_code = reg_w(gspca_dev, data[0], 11);
if (err_code < 0)
return;
return err_code;
data[0] = 0x23; /* address */
data[1] = 0x09; /* reg 35, append frame header */
err_code = reg_w(gspca_dev, data[0], 2);
if (err_code < 0)
return;
return err_code;
data[0] = 0x3c; /* address */
/* if (gspca_dev->width == 1280) */
@ -198,7 +199,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
* (unit: 4KB) 200KB */
err_code = reg_w(gspca_dev, data[0], 2);
if (err_code < 0)
return;
return err_code;
if (0) { /* fixed dark-gain */
data[1] = 0; /* reg 94, Y Gain (1.75) */
@ -240,13 +241,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
err_code = reg_w(gspca_dev, data[0], 6);
if (err_code < 0)
return;
return err_code;
data[0] = 0x67;
data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */
err_code = reg_w(gspca_dev, data[0], 2);
if (err_code < 0)
return;
return err_code;
/*
* initialize the value of MI sensor...
@ -326,6 +327,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x00;
data[1] = 0x4d; /* ISOC transfering enable... */
reg_w(gspca_dev, data[0], 2);
return err_code;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -1854,7 +1854,7 @@ static int set_ov_sensor_window(struct sd *sd)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int ret;
@ -1871,9 +1871,10 @@ static void sd_start(struct gspca_dev *gspca_dev)
goto out;
PDEBUG(D_STREAM, "camera started alt: 0x%02x", gspca_dev->alt);
ov51x_led_control(sd, 1);
return;
return 0;
out:
PDEBUG(D_ERR, "camera start error:%d", ret);
return ret;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -281,7 +281,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 mode;
@ -323,6 +323,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
sd->sof_read = 0;
sd->autogain_ignore_frames = 0;
atomic_set(&sd->avg_lum, -1);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -675,7 +675,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@ -724,6 +724,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x78, 0x01);
else
reg_w(gspca_dev, 0x78, 0x05);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -892,7 +892,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam = &gspca_dev->cam;
@ -976,6 +976,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
sd->frames_to_drop = 0;
sd->autogain_ignore_frames = 0;
atomic_set(&sd->avg_lum, -1);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -1203,7 +1203,7 @@ static void setvflip(struct sd *sd)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
@ -1357,6 +1357,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
}
setautogain(gspca_dev);
reg_w1(gspca_dev, 0x01, reg1);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -660,7 +660,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int err;
@ -867,6 +867,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
write_vector(gspca_dev, Clicksmart510_defaults);
break;
}
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -1980,7 +1980,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
int mode;
@ -2012,6 +2012,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
setbrightness(gspca_dev);
setcontrast(gspca_dev);
setcolors(gspca_dev);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -688,7 +688,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
int ret;
@ -733,6 +733,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* reg_write(dev, 0x5, 0x0, 0x0); */
/* reg_write(dev, 0x5, 0x0, 0x1); */
/* reg_write(dev, 0x5, 0x11, 0x2); */
return ret;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -422,7 +422,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
__u16 norme;
@ -549,6 +549,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
PDEBUG(D_STREAM, "webcam started");
spca506_GetNormeInput(gspca_dev, &norme, &channel);
spca506_SetNormeInput(gspca_dev, norme, channel);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -1528,7 +1528,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
int mode;
@ -1546,6 +1546,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
break;
}
reg_write(gspca_dev->dev, 0x8112, 0x10 | 0x20);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -699,7 +699,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
sd->ag_cnt = -1;
}
static void sd_start_12a(struct gspca_dev *gspca_dev)
static int sd_start_12a(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
int Clck = 0x8a; /* lower 0x8X values lead to fps > 30 */
@ -725,8 +725,9 @@ static void sd_start_12a(struct gspca_dev *gspca_dev)
setwhite(gspca_dev);
setautogain(gspca_dev);
setexposure(gspca_dev);
return 0;
}
static void sd_start_72a(struct gspca_dev *gspca_dev)
static int sd_start_72a(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
int Clck;
@ -750,6 +751,7 @@ static void sd_start_72a(struct gspca_dev *gspca_dev)
reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */
reg_w_val(dev, 0x8112, 0x10 | 0x20);
setautogain(gspca_dev);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -324,7 +324,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
int ret, value;
@ -374,9 +374,10 @@ static void sd_start(struct gspca_dev *gspca_dev)
set_par(gspca_dev, 0x01000000);
set_par(gspca_dev, 0x01000000);
PDEBUG(D_STREAM, "camera started alt: 0x%02x", gspca_dev->alt);
return;
return 0;
out:
PDEBUG(D_ERR|D_STREAM, "camera start err %d", ret);
return ret;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -961,7 +961,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
@ -1042,6 +1042,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
break;
}
sp5xx_initContBrigHueRegisters(gspca_dev);
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -849,7 +849,7 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
int mode;
@ -898,6 +898,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
setbrightness(gspca_dev);
setcontrast(gspca_dev);
setcolors(gspca_dev);
return 0;
}
static void sd_pkt_scan(struct gspca_dev *gspca_dev,

View File

@ -390,7 +390,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
}
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x32);
reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x00);
@ -443,6 +443,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/************************************************/
tv_8532_PollReg(gspca_dev);
reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x00); /* 0x31 */
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -1501,7 +1501,7 @@ static void setlightfreq(struct gspca_dev *gspca_dev)
usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]);
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
const __u8 *GammaT = NULL;
@ -1585,7 +1585,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
break;
default:
PDEBUG(D_PROBE, "Damned !! no sensor found Bye");
return;
return -EMEDIUMTYPE;
}
if (GammaT && MatrixT) {
put_tab_to_reg(gspca_dev, GammaT, 17, 0xb84a);
@ -1621,6 +1621,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
setautogain(gspca_dev);
setlightfreq(gspca_dev);
}
return 0;
}
static void sd_stopN(struct gspca_dev *gspca_dev)

View File

@ -7178,7 +7178,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void sd_start(struct gspca_dev *gspca_dev)
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
@ -7331,6 +7331,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, 0x02, 0x0008);
break;
}
return 0;
}
static void sd_stop0(struct gspca_dev *gspca_dev)