diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-09-10 03:27:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 13:06:38 -0400 |
commit | da4cd8dfe18ee901b880f94ca0fa79d5cc1cd0eb (patch) | |
tree | 7f135b3c3d9450e3b489cd39af6085e338013613 /drivers | |
parent | 2ddee1b7a732dc96d479afaa7d0a26aa53990089 (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/ftape/lowlevel/fdc-io.c | 6 | ||||
-rw-r--r-- | drivers/char/hw_random.c | 5 | ||||
-rw-r--r-- | drivers/char/ip2/i2lib.c | 6 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 18 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 6 | ||||
-rw-r--r-- | drivers/char/mxser.c | 12 |
6 files changed, 17 insertions, 36 deletions
diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c index 1704a2a57048..b2e0928e8428 100644 --- a/drivers/char/ftape/lowlevel/fdc-io.c +++ b/drivers/char/ftape/lowlevel/fdc-io.c | |||
@@ -387,10 +387,8 @@ int fdc_interrupt_wait(unsigned int time) | |||
387 | 387 | ||
388 | set_current_state(TASK_INTERRUPTIBLE); | 388 | set_current_state(TASK_INTERRUPTIBLE); |
389 | add_wait_queue(&ftape_wait_intr, &wait); | 389 | add_wait_queue(&ftape_wait_intr, &wait); |
390 | while (!ft_interrupt_seen && timeout) { | 390 | while (!ft_interrupt_seen && timeout) |
391 | set_current_state(TASK_INTERRUPTIBLE); | 391 | timeout = schedule_timeout_interruptible(timeout); |
392 | timeout = schedule_timeout(timeout); | ||
393 | } | ||
394 | 392 | ||
395 | spin_lock_irq(¤t->sighand->siglock); | 393 | spin_lock_irq(¤t->sighand->siglock); |
396 | current->blocked = old_sigmask; | 394 | current->blocked = old_sigmask; |
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c index 3480535a09c5..6f673d2de0b1 100644 --- a/drivers/char/hw_random.c +++ b/drivers/char/hw_random.c | |||
@@ -513,10 +513,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, | |||
513 | return ret ? : -EAGAIN; | 513 | return ret ? : -EAGAIN; |
514 | 514 | ||
515 | if(need_resched()) | 515 | if(need_resched()) |
516 | { | 516 | schedule_timeout_interruptible(1); |
517 | current->state = TASK_INTERRUPTIBLE; | ||
518 | schedule_timeout(1); | ||
519 | } | ||
520 | else | 517 | else |
521 | udelay(200); /* FIXME: We could poll for 250uS ?? */ | 518 | udelay(200); /* FIXME: We could poll for 250uS ?? */ |
522 | 519 | ||
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index 82c5f30375ac..ba85eb1b6ec7 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c | |||
@@ -655,8 +655,7 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands, | |||
655 | timeout--; // So negative values == forever | 655 | timeout--; // So negative values == forever |
656 | 656 | ||
657 | if (!in_interrupt()) { | 657 | if (!in_interrupt()) { |
658 | current->state = TASK_INTERRUPTIBLE; | 658 | schedule_timeout_interruptible(1); // short nap |
659 | schedule_timeout(1); // short nap | ||
660 | } else { | 659 | } else { |
661 | // we cannot sched/sleep in interrrupt silly | 660 | // we cannot sched/sleep in interrrupt silly |
662 | return 0; | 661 | return 0; |
@@ -1132,8 +1131,7 @@ i2Output(i2ChanStrPtr pCh, const char *pSource, int count, int user ) | |||
1132 | 1131 | ||
1133 | ip2trace (CHANN, ITRC_OUTPUT, 61, 0 ); | 1132 | ip2trace (CHANN, ITRC_OUTPUT, 61, 0 ); |
1134 | 1133 | ||
1135 | current->state = TASK_INTERRUPTIBLE; | 1134 | schedule_timeout_interruptible(2); |
1136 | schedule_timeout(2); | ||
1137 | if (signal_pending(current)) { | 1135 | if (signal_pending(current)) { |
1138 | break; | 1136 | break; |
1139 | } | 1137 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 278f84104996..b6e5cbfb09f8 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1920,8 +1920,7 @@ static int try_get_dev_id(struct smi_info *smi_info) | |||
1920 | for (;;) | 1920 | for (;;) |
1921 | { | 1921 | { |
1922 | if (smi_result == SI_SM_CALL_WITH_DELAY) { | 1922 | if (smi_result == SI_SM_CALL_WITH_DELAY) { |
1923 | set_current_state(TASK_UNINTERRUPTIBLE); | 1923 | schedule_timeout_uninterruptible(1); |
1924 | schedule_timeout(1); | ||
1925 | smi_result = smi_info->handlers->event( | 1924 | smi_result = smi_info->handlers->event( |
1926 | smi_info->si_sm, 100); | 1925 | smi_info->si_sm, 100); |
1927 | } | 1926 | } |
@@ -2256,10 +2255,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2256 | 2255 | ||
2257 | /* Wait for the timer to stop. This avoids problems with race | 2256 | /* Wait for the timer to stop. This avoids problems with race |
2258 | conditions removing the timer here. */ | 2257 | conditions removing the timer here. */ |
2259 | while (! new_smi->timer_stopped) { | 2258 | while (!new_smi->timer_stopped) |
2260 | set_current_state(TASK_UNINTERRUPTIBLE); | 2259 | schedule_timeout_uninterruptible(1); |
2261 | schedule_timeout(1); | ||
2262 | } | ||
2263 | 2260 | ||
2264 | out_err: | 2261 | out_err: |
2265 | if (new_smi->intf) | 2262 | if (new_smi->intf) |
@@ -2379,17 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean) | |||
2379 | 2376 | ||
2380 | /* Wait for the timer to stop. This avoids problems with race | 2377 | /* Wait for the timer to stop. This avoids problems with race |
2381 | conditions removing the timer here. */ | 2378 | conditions removing the timer here. */ |
2382 | while (! to_clean->timer_stopped) { | 2379 | while (!to_clean->timer_stopped) |
2383 | set_current_state(TASK_UNINTERRUPTIBLE); | 2380 | schedule_timeout_uninterruptible(1); |
2384 | schedule_timeout(1); | ||
2385 | } | ||
2386 | 2381 | ||
2387 | /* Interrupts and timeouts are stopped, now make sure the | 2382 | /* Interrupts and timeouts are stopped, now make sure the |
2388 | interface is in a clean state. */ | 2383 | interface is in a clean state. */ |
2389 | while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { | 2384 | while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { |
2390 | poll(to_clean); | 2385 | poll(to_clean); |
2391 | set_current_state(TASK_UNINTERRUPTIBLE); | 2386 | schedule_timeout_uninterruptible(1); |
2392 | schedule_timeout(1); | ||
2393 | } | 2387 | } |
2394 | 2388 | ||
2395 | rv = ipmi_unregister_smi(to_clean->intf); | 2389 | rv = ipmi_unregister_smi(to_clean->intf); |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index e71aaae855ad..2da64bf7469c 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -1037,10 +1037,8 @@ static __exit void ipmi_unregister_watchdog(void) | |||
1037 | /* Wait to make sure the message makes it out. The lower layer has | 1037 | /* Wait to make sure the message makes it out. The lower layer has |
1038 | pointers to our buffers, we want to make sure they are done before | 1038 | pointers to our buffers, we want to make sure they are done before |
1039 | we release our memory. */ | 1039 | we release our memory. */ |
1040 | while (atomic_read(&set_timeout_tofree)) { | 1040 | while (atomic_read(&set_timeout_tofree)) |
1041 | set_current_state(TASK_UNINTERRUPTIBLE); | 1041 | schedule_timeout_uninterruptible(1); |
1042 | schedule_timeout(1); | ||
1043 | } | ||
1044 | 1042 | ||
1045 | /* Disconnect from IPMI. */ | 1043 | /* Disconnect from IPMI. */ |
1046 | rv = ipmi_destroy_user(watchdog_user); | 1044 | rv = ipmi_destroy_user(watchdog_user); |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index d0ef1ae41298..45d012d85e8c 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -1058,8 +1058,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1058 | */ | 1058 | */ |
1059 | timeout = jiffies + HZ; | 1059 | timeout = jiffies + HZ; |
1060 | while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) { | 1060 | while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) { |
1061 | set_current_state(TASK_INTERRUPTIBLE); | 1061 | schedule_timeout_interruptible(5); |
1062 | schedule_timeout(5); | ||
1063 | if (time_after(jiffies, timeout)) | 1062 | if (time_after(jiffies, timeout)) |
1064 | break; | 1063 | break; |
1065 | } | 1064 | } |
@@ -1080,10 +1079,8 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1080 | info->event = 0; | 1079 | info->event = 0; |
1081 | info->tty = NULL; | 1080 | info->tty = NULL; |
1082 | if (info->blocked_open) { | 1081 | if (info->blocked_open) { |
1083 | if (info->close_delay) { | 1082 | if (info->close_delay) |
1084 | set_current_state(TASK_INTERRUPTIBLE); | 1083 | schedule_timeout_interruptible(info->close_delay); |
1085 | schedule_timeout(info->close_delay); | ||
1086 | } | ||
1087 | wake_up_interruptible(&info->open_wait); | 1084 | wake_up_interruptible(&info->open_wait); |
1088 | } | 1085 | } |
1089 | 1086 | ||
@@ -1801,8 +1798,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1801 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT | 1798 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT |
1802 | printk("lsr = %d (jiff=%lu)...", lsr, jiffies); | 1799 | printk("lsr = %d (jiff=%lu)...", lsr, jiffies); |
1803 | #endif | 1800 | #endif |
1804 | set_current_state(TASK_INTERRUPTIBLE); | 1801 | schedule_timeout_interruptible(char_time); |
1805 | schedule_timeout(char_time); | ||
1806 | if (signal_pending(current)) | 1802 | if (signal_pending(current)) |
1807 | break; | 1803 | break; |
1808 | if (timeout && time_after(jiffies, orig_jiffies + timeout)) | 1804 | if (timeout && time_after(jiffies, orig_jiffies + timeout)) |