Commit da4cd8dfe18ee901b880f94ca0fa79d5cc1cd0eb

Authored by Nishanth Aravamudan
Committed by Linus Torvalds
1 parent 2ddee1b7a7

[PATCH] drivers/char: fix-up schedule_timeout() usage

Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 6 changed files with 17 additions and 36 deletions Side-by-side Diff

drivers/char/ftape/lowlevel/fdc-io.c
... ... @@ -387,10 +387,8 @@
387 387  
388 388 set_current_state(TASK_INTERRUPTIBLE);
389 389 add_wait_queue(&ftape_wait_intr, &wait);
390   - while (!ft_interrupt_seen && timeout) {
391   - set_current_state(TASK_INTERRUPTIBLE);
392   - timeout = schedule_timeout(timeout);
393   - }
  390 + while (!ft_interrupt_seen && timeout)
  391 + timeout = schedule_timeout_interruptible(timeout);
394 392  
395 393 spin_lock_irq(&current->sighand->siglock);
396 394 current->blocked = old_sigmask;
drivers/char/hw_random.c
... ... @@ -513,10 +513,7 @@
513 513 return ret ? : -EAGAIN;
514 514  
515 515 if(need_resched())
516   - {
517   - current->state = TASK_INTERRUPTIBLE;
518   - schedule_timeout(1);
519   - }
  516 + schedule_timeout_interruptible(1);
520 517 else
521 518 udelay(200); /* FIXME: We could poll for 250uS ?? */
522 519  
drivers/char/ip2/i2lib.c
... ... @@ -655,8 +655,7 @@
655 655 timeout--; // So negative values == forever
656 656  
657 657 if (!in_interrupt()) {
658   - current->state = TASK_INTERRUPTIBLE;
659   - schedule_timeout(1); // short nap
  658 + schedule_timeout_interruptible(1); // short nap
660 659 } else {
661 660 // we cannot sched/sleep in interrrupt silly
662 661 return 0;
... ... @@ -1132,8 +1131,7 @@
1132 1131  
1133 1132 ip2trace (CHANN, ITRC_OUTPUT, 61, 0 );
1134 1133  
1135   - current->state = TASK_INTERRUPTIBLE;
1136   - schedule_timeout(2);
  1134 + schedule_timeout_interruptible(2);
1137 1135 if (signal_pending(current)) {
1138 1136 break;
1139 1137 }
drivers/char/ipmi/ipmi_si_intf.c
... ... @@ -1920,8 +1920,7 @@
1920 1920 for (;;)
1921 1921 {
1922 1922 if (smi_result == SI_SM_CALL_WITH_DELAY) {
1923   - set_current_state(TASK_UNINTERRUPTIBLE);
1924   - schedule_timeout(1);
  1923 + schedule_timeout_uninterruptible(1);
1925 1924 smi_result = smi_info->handlers->event(
1926 1925 smi_info->si_sm, 100);
1927 1926 }
... ... @@ -2256,10 +2255,8 @@
2256 2255  
2257 2256 /* Wait for the timer to stop. This avoids problems with race
2258 2257 conditions removing the timer here. */
2259   - while (! new_smi->timer_stopped) {
2260   - set_current_state(TASK_UNINTERRUPTIBLE);
2261   - schedule_timeout(1);
2262   - }
  2258 + while (!new_smi->timer_stopped)
  2259 + schedule_timeout_uninterruptible(1);
2263 2260  
2264 2261 out_err:
2265 2262 if (new_smi->intf)
2266 2263  
... ... @@ -2379,17 +2376,14 @@
2379 2376  
2380 2377 /* Wait for the timer to stop. This avoids problems with race
2381 2378 conditions removing the timer here. */
2382   - while (! to_clean->timer_stopped) {
2383   - set_current_state(TASK_UNINTERRUPTIBLE);
2384   - schedule_timeout(1);
2385   - }
  2379 + while (!to_clean->timer_stopped)
  2380 + schedule_timeout_uninterruptible(1);
2386 2381  
2387 2382 /* Interrupts and timeouts are stopped, now make sure the
2388 2383 interface is in a clean state. */
2389 2384 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
2390 2385 poll(to_clean);
2391   - set_current_state(TASK_UNINTERRUPTIBLE);
2392   - schedule_timeout(1);
  2386 + schedule_timeout_uninterruptible(1);
2393 2387 }
2394 2388  
2395 2389 rv = ipmi_unregister_smi(to_clean->intf);
drivers/char/ipmi/ipmi_watchdog.c
... ... @@ -1037,10 +1037,8 @@
1037 1037 /* Wait to make sure the message makes it out. The lower layer has
1038 1038 pointers to our buffers, we want to make sure they are done before
1039 1039 we release our memory. */
1040   - while (atomic_read(&set_timeout_tofree)) {
1041   - set_current_state(TASK_UNINTERRUPTIBLE);
1042   - schedule_timeout(1);
1043   - }
  1040 + while (atomic_read(&set_timeout_tofree))
  1041 + schedule_timeout_uninterruptible(1);
1044 1042  
1045 1043 /* Disconnect from IPMI. */
1046 1044 rv = ipmi_destroy_user(watchdog_user);
drivers/char/mxser.c
... ... @@ -1058,8 +1058,7 @@
1058 1058 */
1059 1059 timeout = jiffies + HZ;
1060 1060 while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) {
1061   - set_current_state(TASK_INTERRUPTIBLE);
1062   - schedule_timeout(5);
  1061 + schedule_timeout_interruptible(5);
1063 1062 if (time_after(jiffies, timeout))
1064 1063 break;
1065 1064 }
... ... @@ -1080,10 +1079,8 @@
1080 1079 info->event = 0;
1081 1080 info->tty = NULL;
1082 1081 if (info->blocked_open) {
1083   - if (info->close_delay) {
1084   - set_current_state(TASK_INTERRUPTIBLE);
1085   - schedule_timeout(info->close_delay);
1086   - }
  1082 + if (info->close_delay)
  1083 + schedule_timeout_interruptible(info->close_delay);
1087 1084 wake_up_interruptible(&info->open_wait);
1088 1085 }
1089 1086  
... ... @@ -1801,8 +1798,7 @@
1801 1798 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
1802 1799 printk("lsr = %d (jiff=%lu)...", lsr, jiffies);
1803 1800 #endif
1804   - set_current_state(TASK_INTERRUPTIBLE);
1805   - schedule_timeout(char_time);
  1801 + schedule_timeout_interruptible(char_time);
1806 1802 if (signal_pending(current))
1807 1803 break;
1808 1804 if (timeout && time_after(jiffies, orig_jiffies + timeout))