[media] gspca: Update / fix various comments wrt workqueue usb_lock usage

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans de Goede 2012-09-09 07:30:02 -03:00 коммит произвёл Mauro Carvalho Chehab
Родитель ff8f25d326
Коммит 844db450e6
8 изменённых файлов: 36 добавлений и 29 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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)
{
@ -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)
{

Просмотреть файл

@ -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)
@ -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;