Skip to contentSkip to conversation

usb/dabusb: insert set_current_state()

PATCH In review Nishanth Aravamudan 1 participant 3 messages Jul 27, 2004 – Jul 28, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb/dabusb: insert set_current_state()

I would appreciate any comments from the janitors list.

Applys-to: 2.6.7

Description: Move non-blocking conditional check outside while-loop. Insert set_current_stateo() so schedule_timeout() functions as expected.

drivers/usb/media/dabusb.c +5 -3
@@ -592,12 +592,14 @@ static int dabusb_open (struct inode *in
 	dbg("dabusb_open");
 	down (&s->mutex);
 
+	if (file->f_flags & O_NONBLOCK) {
+		return -EBUSY;
+	}
+	
 	while (!s->usbdev || s->opened) {
 		up (&s->mutex);
 
-		if (file->f_flags & O_NONBLOCK) {
-			return -EBUSY;
-		}
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout (HZ / 2);
 
 		if (signal_pending (current)) {

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

PATCH 1/1 usb/dabusb: insert set_current_state()

I would appreciate any comments from the janitors list.

Applys-to: 2.6.7

Description: Insert set_current_stateo() so schedule_timeout() functions as expected.

drivers/usb/misc/tiglusb.c +1 -0
@@ -115,6 +115,7 @@ tiglusb_open (struct inode *inode, struc
 			return -EBUSY;
 		}
 
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout (HZ / 2);
 
 		if (signal_pending (current)) {

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Nishanth Aravamudan

After discussing this patch with Mark Hollomon, I think it is much safer / better to leave the conditional check within the while loop. This way the mutex state is as expected and maintainability is not compromised. The previous patch should not be applied.

Applys-to: 2.6.7

Description: Inserts appropriate set_current_state() call so that schedule_timeout() functions as expected.

drivers/usb/media/dabusb.c +1 -0
@@ -598,6 +598,7 @@ static int dabusb_open (struct inode *in
 		if (file->f_flags & O_NONBLOCK) {
 			return -EBUSY;
 		}
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout (HZ / 2);
 
 		if (signal_pending (current)) {

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors