Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Hans de Goede and committed by
Mauro Carvalho Chehab
844db450 ff8f25d3

+36 -29
+8 -1
drivers/media/usb/gspca/finepix.c
··· 77 77 12, FPIX_TIMEOUT); 78 78 } 79 79 80 - /* workqueue */ 80 + /* 81 + * This function is called as a workqueue function and runs whenever the camera 82 + * is streaming data. Because it is a workqueue function it is allowed to sleep 83 + * so we can use synchronous USB calls. To avoid possible collisions with other 84 + * threads attempting to use gspca_dev->usb_buf we take the usb_lock when 85 + * performing USB operations using it. In practice we don't really need this 86 + * as the camera doesn't provide any controls. 87 + */ 81 88 static void dostream(struct work_struct *work) 82 89 { 83 90 struct usb_fpix *dev = container_of(work, struct usb_fpix, work_struct);
+5 -7
drivers/media/usb/gspca/jl2005bcd.c
··· 306 306 return retval; 307 307 } 308 308 309 - /* This function is called as a workqueue function and runs whenever the camera 309 + /* 310 + * This function is called as a workqueue function and runs whenever the camera 310 311 * is streaming data. Because it is a workqueue function it is allowed to sleep 311 312 * so we can use synchronous USB calls. To avoid possible collisions with other 312 - * threads attempting to use the camera's USB interface the gspca usb_lock is 313 - * used when performing the one USB control operation inside the workqueue, 314 - * which tells the camera to close the stream. In practice the only thing 315 - * which needs to be protected against is the usb_set_interface call that 316 - * gspca makes during stream_off. Otherwise the camera doesn't provide any 317 - * controls that the user could try to change. 313 + * threads attempting to use gspca_dev->usb_buf we take the usb_lock when 314 + * performing USB operations using it. In practice we don't really need this 315 + * as the camera doesn't provide any controls. 318 316 */ 319 317 static void jl2005c_dostream(struct work_struct *work) 320 318 {
+2
drivers/media/usb/gspca/sn9c20x.c
··· 2197 2197 struct gspca_dev *gspca_dev = &sd->gspca_dev; 2198 2198 s32 qual = v4l2_ctrl_g_ctrl(sd->jpegqual); 2199 2199 2200 + /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */ 2200 2201 mutex_lock(&gspca_dev->usb_lock); 2201 2202 PDEBUG(D_STREAM, "qual_upd %d%%", qual); 2203 + gspca_dev->usb_err = 0; 2202 2204 set_quality(gspca_dev, qual); 2203 2205 mutex_unlock(&gspca_dev->usb_lock); 2204 2206 }
+2
drivers/media/usb/gspca/sonixj.c
··· 2380 2380 struct sd *sd = container_of(work, struct sd, work); 2381 2381 struct gspca_dev *gspca_dev = &sd->gspca_dev; 2382 2382 2383 + /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */ 2383 2384 mutex_lock(&gspca_dev->usb_lock); 2384 2385 PDEBUG(D_STREAM, "qual_upd %d%%", sd->quality); 2386 + gspca_dev->usb_err = 0; 2385 2387 setjpegqual(gspca_dev); 2386 2388 mutex_unlock(&gspca_dev->usb_lock); 2387 2389 }
+5 -6
drivers/media/usb/gspca/sq905.c
··· 201 201 return 0; 202 202 } 203 203 204 - /* This function is called as a workqueue function and runs whenever the camera 204 + /* 205 + * This function is called as a workqueue function and runs whenever the camera 205 206 * is streaming data. Because it is a workqueue function it is allowed to sleep 206 207 * so we can use synchronous USB calls. To avoid possible collisions with other 207 - * threads attempting to use the camera's USB interface we take the gspca 208 - * usb_lock when performing USB operations. In practice the only thing we need 209 - * to protect against is the usb_set_interface call that gspca makes during 210 - * stream_off as the camera doesn't provide any controls that the user could try 211 - * to change. 208 + * threads attempting to use gspca_dev->usb_buf we take the usb_lock when 209 + * performing USB operations using it. In practice we don't really need this 210 + * as the camera doesn't provide any controls. 212 211 */ 213 212 static void sq905_dostream(struct work_struct *work) 214 213 {
+5 -7
drivers/media/usb/gspca/sq905c.c
··· 123 123 return 0; 124 124 } 125 125 126 - /* This function is called as a workqueue function and runs whenever the camera 126 + /* 127 + * This function is called as a workqueue function and runs whenever the camera 127 128 * is streaming data. Because it is a workqueue function it is allowed to sleep 128 129 * so we can use synchronous USB calls. To avoid possible collisions with other 129 - * threads attempting to use the camera's USB interface the gspca usb_lock is 130 - * used when performing the one USB control operation inside the workqueue, 131 - * which tells the camera to close the stream. In practice the only thing 132 - * which needs to be protected against is the usb_set_interface call that 133 - * gspca makes during stream_off. Otherwise the camera doesn't provide any 134 - * controls that the user could try to change. 130 + * threads attempting to use gspca_dev->usb_buf we take the usb_lock when 131 + * performing USB operations using it. In practice we don't really need this 132 + * as the camera doesn't provide any controls. 135 133 */ 136 134 static void sq905c_dostream(struct work_struct *work) 137 135 {
+6 -7
drivers/media/usb/gspca/vicam.c
··· 110 110 } 111 111 112 112 /* 113 - * request and read a block of data - see warning on vicam_command. 113 + * request and read a block of data 114 114 */ 115 115 static int vicam_read_frame(struct gspca_dev *gspca_dev, u8 *data, int size) 116 116 { ··· 170 170 return 0; 171 171 } 172 172 173 - /* This function is called as a workqueue function and runs whenever the camera 173 + /* 174 + * This function is called as a workqueue function and runs whenever the camera 174 175 * is streaming data. Because it is a workqueue function it is allowed to sleep 175 176 * so we can use synchronous USB calls. To avoid possible collisions with other 176 - * threads attempting to use the camera's USB interface we take the gspca 177 - * usb_lock when performing USB operations. In practice the only thing we need 178 - * to protect against is the usb_set_interface call that gspca makes during 179 - * stream_off as the camera doesn't provide any controls that the user could try 180 - * to change. 177 + * threads attempting to use gspca_dev->usb_buf we take the usb_lock when 178 + * performing USB operations using it. In practice we don't really need this 179 + * as the cameras controls are only written from the workqueue. 181 180 */ 182 181 static void vicam_dostream(struct work_struct *work) 183 182 {
+3 -1
drivers/media/usb/gspca/zc3xx.c
··· 5945 5945 for (;;) { 5946 5946 msleep(100); 5947 5947 5948 + /* To protect gspca_dev->usb_buf and gspca_dev->usb_err */ 5948 5949 mutex_lock(&gspca_dev->usb_lock); 5949 5950 #ifdef CONFIG_PM 5950 5951 if (gspca_dev->frozen) ··· 6832 6831 return 0; 6833 6832 } 6834 6833 6835 - /* called on streamoff with alt 0 and on disconnect */ 6834 + /* called on streamoff with alt==0 and on disconnect */ 6835 + /* the usb_lock is held at entry - restore on exit */ 6836 6836 static void sd_stop0(struct gspca_dev *gspca_dev) 6837 6837 { 6838 6838 struct sd *sd = (struct sd *) gspca_dev;