Skip to content

Commit

Permalink
V4L/DVB (9079): gspca: Return error code from stream start functions.
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jean-Francois Moine authored and Mauro Carvalho Chehab committed Oct 12, 2008
1 parent 1b60e1a commit 72ab97c
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 34 deletions.
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/conex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/etoms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/gspca/gspca.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
20 changes: 11 additions & 9 deletions drivers/media/video/gspca/mars.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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) */
Expand All @@ -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) */
Expand Down Expand Up @@ -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...
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions drivers/media/video/gspca/ov519.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/pac207.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/pac7311.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/sonixb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/sonixj.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/spca500.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/spca501.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/spca505.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/spca506.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/spca508.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions drivers/media/video/gspca/spca561.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions drivers/media/video/gspca/stk014.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/sunplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/video/gspca/t613.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 72ab97c

Please sign in to comment.