input/iforce-packets: insert set_current_state()
Quoted 1 line · Nishanth Aravamudan
Any comments would be, as always, appreciated.
The right solution is to use wait_event_interruptible_timeout(). I changed the code to do that. Thanks for the bug report.
(Unfortunately it still isn't perfect, because we shouldn't be checking the URB status directly, but rather some atomic variable. Not too bad, though.)
Quoted 34 lines
-Nish
Description: Inserts
set_current_state()beforeschedule_timeout(). Without the insertion,schedule_timeout()will return immediately.Signed-off-by Nishanth Aravamudan <[email protected]>drivers/input/joystick/iforce/iforce-packets.c +6
-2@@ -269,8 +269,10 @@ int iforce_get_id_packet(struct iforce *return -1 ; } -while (timeout && iforce->ctrl->status == -EINPROGRESS ) +while (timeout && iforce->ctrl->status == -EINPROGRESS ) { +set_current_state (TASK_INTERRUPTIBLE ); timeout =schedule_timeout (timeout); + }set_current_state (TASK_RUNNING );remove_wait_queue (&iforce->wait, &wait);@@ -293,8 +295,10 @@ int iforce_get_id_packet(struct iforce *set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&iforce->wait, &wait); -while (timeout && iforce->expect_packet) +while (timeout && iforce->expect_packet) { +set_current_state (TASK_INTERRUPTIBLE ); timeout =schedule_timeout (timeout); + }set_current_state (TASK_RUNNING );remove_wait_queue (&iforce->wait, &wait);
Signature · 2 lines
Vojtech Pavlik SuSE Labs, SuSE CR
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors