From: Greg KH To: marcelo@conectiva.com.br Cc: linux-usb-devel@lists.sourceforge.net Subject: [PATCH 13 of 14] USB vicam driver bugfix Hi, Here's a patch against 2.4.19-pre2 that fixes some bugs in the USB vicam driver. This patch was done by Oliver Neukum. thanks, greg k-h diff -Nru a/drivers/usb/vicam.c b/drivers/usb/vicam.c --- a/drivers/usb/vicam.c Mon Mar 4 08:49:00 2002 +++ b/drivers/usb/vicam.c Mon Mar 4 08:49:00 2002 @@ -79,7 +79,7 @@ static struct usb_driver vicam_driver; static char *buf, *buf2; -static int change_pending = 0; +static volatile int change_pending = 0; static int vicam_parameters(struct usb_vicam *vicam); @@ -330,8 +330,14 @@ static void synchronize(struct usb_vicam *vicam) { + DECLARE_WAITQUEUE(wait, current); change_pending = 1; - interruptible_sleep_on(&vicam->wait); + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&vicam->wait, &wait); + if (change_pending) + schedule(); + remove_wait_queue(&vicam->wait, &wait); + set_current_state(TASK_RUNNING); vicam_sndctrl(1, vicam, VICAM_REQ_CAMERA_POWER, 0x00, NULL, 0); mdelay(10); vicam_sndctrl(1, vicam, VICAM_REQ_LED_CONTROL, 0x00, NULL, 0); @@ -890,13 +896,16 @@ vicam->win.contrast = 10; /* FIXME */ - if (vicam_init(vicam)) + if (vicam_init(vicam)) { + kfree(vicam); return NULL; + } memcpy(&vicam->vdev, &vicam_template, sizeof(vicam_template)); memcpy(vicam->vdev.name, vicam->camera_name, strlen(vicam->camera_name)); if (video_register_device(&vicam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { err("video_register_device"); + kfree(vicam); return NULL; }