Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 844db450 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

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

parent ff8f25d3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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);
+5 −7
Original line number Diff line number Diff line
@@ -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)
{
+2 −0
Original line number Diff line number Diff line
@@ -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);
}
+2 −0
Original line number Diff line number Diff line
@@ -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);
}
+5 −6
Original line number Diff line number Diff line
@@ -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)
{
Loading