[PATCH] drivers/char: fix-up schedule_timeout() usage
authorNishanth Aravamudan <nacc@us.ibm.com>
Sat, 10 Sep 2005 07:27:30 +0000 (00:27 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 10 Sep 2005 17:06:38 +0000 (10:06 -0700)
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>
drivers/char/ftape/lowlevel/fdc-io.c
drivers/char/hw_random.c
drivers/char/ip2/i2lib.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/ipmi/ipmi_watchdog.c
drivers/char/mxser.c

index 1704a2a57048b85adda6bd799d488b053940ffc6..b2e0928e84288b6a392e7951fd3724649a54fd27 100644 (file)
@@ -387,10 +387,8 @@ int fdc_interrupt_wait(unsigned int time)
 
        set_current_state(TASK_INTERRUPTIBLE);
        add_wait_queue(&ftape_wait_intr, &wait);
-       while (!ft_interrupt_seen && timeout) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               timeout = schedule_timeout(timeout);
-        }
+       while (!ft_interrupt_seen && timeout)
+               timeout = schedule_timeout_interruptible(timeout);
 
        spin_lock_irq(&current->sighand->siglock);
        current->blocked = old_sigmask;
index 3480535a09c5f113af1ca110bb0fa37ae58c2206..6f673d2de0b1717439e5d908f4ce3e5cb4b85072 100644 (file)
@@ -513,10 +513,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
                        return ret ? : -EAGAIN;
 
                if(need_resched())
-               {
-                       current->state = TASK_INTERRUPTIBLE;
-                       schedule_timeout(1);
-               }
+                       schedule_timeout_interruptible(1);
                else
                        udelay(200);    /* FIXME: We could poll for 250uS ?? */
 
index 82c5f30375acc816cd879dc0d083767cb9cd457a..ba85eb1b6ec75bfa56cd10b06b95cd9ff0186ee8 100644 (file)
@@ -655,8 +655,7 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands,
                        timeout--;   // So negative values == forever
                
                if (!in_interrupt()) {
-                       current->state = TASK_INTERRUPTIBLE;
-                       schedule_timeout(1);    // short nap 
+                       schedule_timeout_interruptible(1);      // short nap
                } else {
                        // we cannot sched/sleep in interrrupt silly
                        return 0;   
@@ -1132,8 +1131,7 @@ i2Output(i2ChanStrPtr pCh, const char *pSource, int count, int user )
 
                                        ip2trace (CHANN, ITRC_OUTPUT, 61, 0 );
 
-                                       current->state = TASK_INTERRUPTIBLE;
-                                       schedule_timeout(2);
+                                       schedule_timeout_interruptible(2);
                                        if (signal_pending(current)) {
                                                break;
                                        }
index 278f841049968c15867d25c34e2f17772d375829..b6e5cbfb09f81d897c1dd95079c4e9281dda4ba5 100644 (file)
@@ -1920,8 +1920,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
        for (;;)
        {
                if (smi_result == SI_SM_CALL_WITH_DELAY) {
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);
                        smi_result = smi_info->handlers->event(
                                smi_info->si_sm, 100);
                }
@@ -2256,10 +2255,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
 
        /* Wait for the timer to stop.  This avoids problems with race
           conditions removing the timer here. */
-       while (! new_smi->timer_stopped) {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
-       }
+       while (!new_smi->timer_stopped)
+               schedule_timeout_uninterruptible(1);
 
  out_err:
        if (new_smi->intf)
@@ -2379,17 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
 
        /* Wait for the timer to stop.  This avoids problems with race
           conditions removing the timer here. */
-       while (! to_clean->timer_stopped) {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
-       }
+       while (!to_clean->timer_stopped)
+               schedule_timeout_uninterruptible(1);
 
        /* Interrupts and timeouts are stopped, now make sure the
           interface is in a clean state. */
        while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
                poll(to_clean);
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        }
 
        rv = ipmi_unregister_smi(to_clean->intf);
index e71aaae855adda775f9c296e6d91a333192d8110..2da64bf7469c6963e008e6215c610dae78dd3e3a 100644 (file)
@@ -1037,10 +1037,8 @@ static __exit void ipmi_unregister_watchdog(void)
        /* Wait to make sure the message makes it out.  The lower layer has
           pointers to our buffers, we want to make sure they are done before
           we release our memory. */
-       while (atomic_read(&set_timeout_tofree)) {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
-       }
+       while (atomic_read(&set_timeout_tofree))
+               schedule_timeout_uninterruptible(1);
 
        /* Disconnect from IPMI. */
        rv = ipmi_destroy_user(watchdog_user);
index d0ef1ae412981d774289575dba2ea8a866975e37..45d012d85e8c3d436d33c46e1b809f8dee9216d3 100644 (file)
@@ -1058,8 +1058,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
                 */
                timeout = jiffies + HZ;
                while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(5);
+                       schedule_timeout_interruptible(5);
                        if (time_after(jiffies, timeout))
                                break;
                }
@@ -1080,10 +1079,8 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
        info->event = 0;
        info->tty = NULL;
        if (info->blocked_open) {
-               if (info->close_delay) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(info->close_delay);
-               }
+               if (info->close_delay)
+                       schedule_timeout_interruptible(info->close_delay);
                wake_up_interruptible(&info->open_wait);
        }
 
@@ -1801,8 +1798,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout)
 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
                printk("lsr = %d (jiff=%lu)...", lsr, jiffies);
 #endif
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(char_time);
+               schedule_timeout_interruptible(char_time);
                if (signal_pending(current))
                        break;
                if (timeout && time_after(jiffies, orig_jiffies + timeout))