Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330961
b: refs/heads/master
c: 844db45
h: refs/heads/master
i:
  330959: b86c798
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Sep 13, 2012
1 parent ecf17dc commit dcdfb8a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff8f25d326da5e7cf6216f368116744341fceb12
refs/heads/master: 844db450e6e2cf710752af1a019a877af390b541
9 changes: 8 additions & 1 deletion trunk/drivers/media/usb/gspca/finepix.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ static int command(struct gspca_dev *gspca_dev,
12, FPIX_TIMEOUT);
}

/* workqueue */
/*
* This function is called as a workqueue function and runs whenever the camera
* is streaming data. Because it is a workqueue function it is allowed to sleep
* so we can use synchronous USB calls. To avoid possible collisions with other
* threads attempting to use gspca_dev->usb_buf we take the usb_lock when
* performing USB operations using it. In practice we don't really need this
* as the camera doesn't provide any controls.
*/
static void dostream(struct work_struct *work)
{
struct usb_fpix *dev = container_of(work, struct usb_fpix, work_struct);
Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/media/usb/gspca/jl2005bcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,13 @@ static int jl2005c_stop(struct gspca_dev *gspca_dev)
return retval;
}

/* This function is called as a workqueue function and runs whenever the camera
/*
* This function is called as a workqueue function and runs whenever the camera
* is streaming data. Because it is a workqueue function it is allowed to sleep
* so we can use synchronous USB calls. To avoid possible collisions with other
* threads attempting to use the camera's USB interface the gspca usb_lock is
* used when performing the one USB control operation inside the workqueue,
* which tells the camera to close the stream. In practice the only thing
* which needs to be protected against is the usb_set_interface call that
* gspca makes during stream_off. Otherwise the camera doesn't provide any
* controls that the user could try to change.
* threads attempting to use gspca_dev->usb_buf we take the usb_lock when
* performing USB operations using it. In practice we don't really need this
* as the camera doesn't provide any controls.
*/
static void jl2005c_dostream(struct work_struct *work)
{
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/media/usb/gspca/sn9c20x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2197,8 +2197,10 @@ static void qual_upd(struct work_struct *work)
struct gspca_dev *gspca_dev = &sd->gspca_dev;
s32 qual = v4l2_ctrl_g_ctrl(sd->jpegqual);

/* To protect gspca_dev->usb_buf and gspca_dev->usb_err */
mutex_lock(&gspca_dev->usb_lock);
PDEBUG(D_STREAM, "qual_upd %d%%", qual);
gspca_dev->usb_err = 0;
set_quality(gspca_dev, qual);
mutex_unlock(&gspca_dev->usb_lock);
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/media/usb/gspca/sonixj.c
Original file line number Diff line number Diff line change
Expand Up @@ -2380,8 +2380,10 @@ static void qual_upd(struct work_struct *work)
struct sd *sd = container_of(work, struct sd, work);
struct gspca_dev *gspca_dev = &sd->gspca_dev;

/* To protect gspca_dev->usb_buf and gspca_dev->usb_err */
mutex_lock(&gspca_dev->usb_lock);
PDEBUG(D_STREAM, "qual_upd %d%%", sd->quality);
gspca_dev->usb_err = 0;
setjpegqual(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
}
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/media/usb/gspca/sq905.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,13 @@ sq905_read_data(struct gspca_dev *gspca_dev, u8 *data, int size, int need_lock)
return 0;
}

/* This function is called as a workqueue function and runs whenever the camera
/*
* This function is called as a workqueue function and runs whenever the camera
* is streaming data. Because it is a workqueue function it is allowed to sleep
* so we can use synchronous USB calls. To avoid possible collisions with other
* threads attempting to use the camera's USB interface we take the gspca
* usb_lock when performing USB operations. In practice the only thing we need
* to protect against is the usb_set_interface call that gspca makes during
* stream_off as the camera doesn't provide any controls that the user could try
* to change.
* threads attempting to use gspca_dev->usb_buf we take the usb_lock when
* performing USB operations using it. In practice we don't really need this
* as the camera doesn't provide any controls.
*/
static void sq905_dostream(struct work_struct *work)
{
Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/media/usb/gspca/sq905c.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,13 @@ static int sq905c_read(struct gspca_dev *gspca_dev, u16 command, u16 index,
return 0;
}

/* This function is called as a workqueue function and runs whenever the camera
/*
* This function is called as a workqueue function and runs whenever the camera
* is streaming data. Because it is a workqueue function it is allowed to sleep
* so we can use synchronous USB calls. To avoid possible collisions with other
* threads attempting to use the camera's USB interface the gspca usb_lock is
* used when performing the one USB control operation inside the workqueue,
* which tells the camera to close the stream. In practice the only thing
* which needs to be protected against is the usb_set_interface call that
* gspca makes during stream_off. Otherwise the camera doesn't provide any
* controls that the user could try to change.
* threads attempting to use gspca_dev->usb_buf we take the usb_lock when
* performing USB operations using it. In practice we don't really need this
* as the camera doesn't provide any controls.
*/
static void sq905c_dostream(struct work_struct *work)
{
Expand Down
13 changes: 6 additions & 7 deletions trunk/drivers/media/usb/gspca/vicam.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int vicam_set_camera_power(struct gspca_dev *gspca_dev, int state)
}

/*
* request and read a block of data - see warning on vicam_command.
* request and read a block of data
*/
static int vicam_read_frame(struct gspca_dev *gspca_dev, u8 *data, int size)
{
Expand Down Expand Up @@ -170,14 +170,13 @@ static int vicam_read_frame(struct gspca_dev *gspca_dev, u8 *data, int size)
return 0;
}

/* This function is called as a workqueue function and runs whenever the camera
/*
* This function is called as a workqueue function and runs whenever the camera
* is streaming data. Because it is a workqueue function it is allowed to sleep
* so we can use synchronous USB calls. To avoid possible collisions with other
* threads attempting to use the camera's USB interface we take the gspca
* usb_lock when performing USB operations. In practice the only thing we need
* to protect against is the usb_set_interface call that gspca makes during
* stream_off as the camera doesn't provide any controls that the user could try
* to change.
* threads attempting to use gspca_dev->usb_buf we take the usb_lock when
* performing USB operations using it. In practice we don't really need this
* as the cameras controls are only written from the workqueue.
*/
static void vicam_dostream(struct work_struct *work)
{
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/media/usb/gspca/zc3xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -5945,6 +5945,7 @@ static void transfer_update(struct work_struct *work)
for (;;) {
msleep(100);

/* To protect gspca_dev->usb_buf and gspca_dev->usb_err */
mutex_lock(&gspca_dev->usb_lock);
#ifdef CONFIG_PM
if (gspca_dev->frozen)
Expand Down Expand Up @@ -6831,7 +6832,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
return 0;
}

/* called on streamoff with alt 0 and on disconnect */
/* called on streamoff with alt==0 and on disconnect */
/* the usb_lock is held at entry - restore on exit */
static void sd_stop0(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
Expand Down

0 comments on commit dcdfb8a

Please sign in to comment.