atm/ambassador: replace
Subsystems (2)
PATCH 1/5 atm/ambassador: replace
Any comments would be appreciated.
Description: msleep() is used instead of schedule_timeout() to guarantee the task delays as expected. Two set_current_state()s were also inserted, as schedule_timeout() will return immediately unless the state is set.
Signed-off-by Nishanth Aravamudan <[email protected]>
drivers/atm/ambassador.c +6 -15
@@ -604,18 +604,13 @@ static int command_do (amb_dev * dev, co// prepare to wait for cq->pending milliseconds // effectively one centisecond on i386 - timeout = (cq->pending*HZ +999 )/1000 ; + timeout = cq->pending;if (cq->pending > cq->high) cq->high = cq->pending;spin_unlock (&cq->lock); -while (timeout) { -// go to sleep -// PRINTD (DBG_CMD, "wait: sleeping %lu for command", timeout); -set_current_state (TASK_UNINTERRUPTIBLE ); - timeout =schedule_timeout (timeout); - } +msleep (timeout);// wait for my slot to be reached (all waiters are here or above, until...) while (ptrs->out != my_slot) {
@@ -1847,6 +1842,7 @@ static int __init do_loader_command (vol timeout =HZ /10 ;while (rd_plain (dev, offsetof(amb_mem , doorbell)))if (timeout) { +set_current_state (TASK_UNINTERRUPTIBLE ); timeout =schedule_timeout (timeout); }else { PRINTD (DBG_LOAD|DBG_ERR, "start command did not clear doorbell, res=%08x",
@@ -1962,11 +1958,7 @@ static int amb_reset (amb_dev * dev, intif (diags) {unsigned long timeout;// 4.2 second wait - timeout =HZ *42 /10 ; -while (timeout) { -set_current_state (TASK_UNINTERRUPTIBLE ); - timeout =schedule_timeout (timeout); - } +msleep (4200 );// half second time-out timeout =HZ /2 ; while (!rd_plain (dev, offsetof(amb_mem, mb.loader.ready)))
@@ -2086,13 +2078,12 @@ static int __init amb_talk (amb_dev * dewr_mem (dev, offsetof(amb_mem , doorbell),virt_to_bus (&a));// 2.2 second wait (must not touch doorbell during 2 second DMA test) - timeout =HZ *22 /10 ; -while (timeout) - timeout =schedule_timeout (timeout); +msleep (2200 );// give the adapter another half second? timeout =HZ /2 ;while (rd_plain (dev, offsetof(amb_mem , doorbell)))if (timeout) { +set_current_state (TASK_UNINTERRUPTIBLE ); timeout =schedule_timeout (timeout); }else {PRINTD (DBG_INIT |DBG_ERR ,"adapter init timed out" );
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors