Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Nishanth Aravamudan and committed by
Linus Torvalds
da4cd8df 2ddee1b7

+17 -36
+2 -4
drivers/char/ftape/lowlevel/fdc-io.c
··· 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;
+1 -4
drivers/char/hw_random.c
··· 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
+2 -4
drivers/char/ip2/i2lib.c
··· 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; ··· 1131 1132 1132 1133 ip2trace (CHANN, ITRC_OUTPUT, 61, 0 ); 1133 1134 1134 - current->state = TASK_INTERRUPTIBLE; 1135 - schedule_timeout(2); 1135 + schedule_timeout_interruptible(2); 1136 1136 if (signal_pending(current)) { 1137 1137 break; 1138 1138 }
+6 -12
drivers/char/ipmi/ipmi_si_intf.c
··· 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 } ··· 2255 2256 2256 2257 /* Wait for the timer to stop. This avoids problems with race 2257 2258 conditions removing the timer here. */ 2258 - while (! new_smi->timer_stopped) { 2259 - set_current_state(TASK_UNINTERRUPTIBLE); 2260 - schedule_timeout(1); 2261 - } 2259 + while (!new_smi->timer_stopped) 2260 + schedule_timeout_uninterruptible(1); 2262 2261 2263 2262 out_err: 2264 2263 if (new_smi->intf) ··· 2376 2379 2377 2380 /* Wait for the timer to stop. This avoids problems with race 2378 2381 conditions removing the timer here. */ 2379 - while (! to_clean->timer_stopped) { 2380 - set_current_state(TASK_UNINTERRUPTIBLE); 2381 - schedule_timeout(1); 2382 - } 2382 + while (!to_clean->timer_stopped) 2383 + schedule_timeout_uninterruptible(1); 2383 2384 2384 2385 /* Interrupts and timeouts are stopped, now make sure the 2385 2386 interface is in a clean state. */ 2386 2387 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { 2387 2388 poll(to_clean); 2388 - set_current_state(TASK_UNINTERRUPTIBLE); 2389 - schedule_timeout(1); 2389 + schedule_timeout_uninterruptible(1); 2390 2390 } 2391 2391 2392 2392 rv = ipmi_unregister_smi(to_clean->intf);
+2 -4
drivers/char/ipmi/ipmi_watchdog.c
··· 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);
+4 -8
drivers/char/mxser.c
··· 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 } ··· 1079 1080 info->event = 0; 1080 1081 info->tty = NULL; 1081 1082 if (info->blocked_open) { 1082 - if (info->close_delay) { 1083 - set_current_state(TASK_INTERRUPTIBLE); 1084 - schedule_timeout(info->close_delay); 1085 - } 1083 + if (info->close_delay) 1084 + schedule_timeout_interruptible(info->close_delay); 1086 1085 wake_up_interruptible(&info->open_wait); 1087 1086 } 1088 1087 ··· 1798 1801 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT 1799 1802 printk("lsr = %d (jiff=%lu)...", lsr, jiffies); 1800 1803 #endif 1801 - set_current_state(TASK_INTERRUPTIBLE); 1802 - schedule_timeout(char_time); 1804 + schedule_timeout_interruptible(char_time); 1803 1805 if (signal_pending(current)) 1804 1806 break; 1805 1807 if (timeout && time_after(jiffies, orig_jiffies + timeout))