<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Nishanth Aravamudan &lt;nacc@us.ibm.com&gt;

Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.  Also use
human-time conversion functions instead of hard-coded HZ division to avoid
rounding errors.

(akpm: this patch relies on other stuff in -mm, please don't apply)

Signed-off-by: Nishanth Aravamudan &lt;nacc@us.ibm.com&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 arch/ppc/4xx_io/serial_sicc.c |   17 +++++++----------
 arch/ppc/8260_io/fcc_enet.c   |    3 +--
 2 files changed, 8 insertions(+), 12 deletions(-)

diff -puN arch/ppc/4xx_io/serial_sicc.c~ppc-fix-up-schedule_timeout-usage arch/ppc/4xx_io/serial_sicc.c
--- 25/arch/ppc/4xx_io/serial_sicc.c~ppc-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:36 2005
+++ 25-akpm/arch/ppc/4xx_io/serial_sicc.c	Wed Aug 17 17:00:36 2005
@@ -1145,8 +1145,8 @@ static int set_serial_info(struct SICC_i
     info-&gt;flags = ((state-&gt;flags &amp; ~ASYNC_INTERNAL_FLAGS) |
                (info-&gt;flags &amp; ASYNC_INTERNAL_FLAGS));
     state-&gt;custom_divisor = new_serial.custom_divisor;
-    state-&gt;close_delay = new_serial.close_delay * HZ / 100;
-    state-&gt;closing_wait = new_serial.closing_wait * HZ / 100;
+    state-&gt;close_delay = msecs_to_jiffies(10 * new_serial.close_delay);
+    state-&gt;closing_wait = msecs_to_jiffies(10 * new_serial.closing_wait);
     info-&gt;tty-&gt;low_latency = (info-&gt;flags &amp; ASYNC_LOW_LATENCY) ? 1 : 0;
     port-&gt;fifosize = new_serial.xmit_fifo_size;
 
@@ -1465,10 +1465,8 @@ static void siccuart_close(struct tty_st
     info-&gt;event = 0;
     info-&gt;tty = NULL;
     if (info-&gt;blocked_open) {
-        if (info-&gt;state-&gt;close_delay) {
-            set_current_state(TASK_INTERRUPTIBLE);
-            schedule_timeout(info-&gt;state-&gt;close_delay);
-        }
+        if (info-&gt;state-&gt;close_delay)
+            schedule_timeout_interruptible(info-&gt;state-&gt;close_delay);
         wake_up_interruptible(&amp;info-&gt;open_wait);
     }
     info-&gt;flags &amp;= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
@@ -1496,7 +1494,7 @@ static void siccuart_wait_until_sent(str
      * Note: we have to use pretty tight timings here to satisfy
      * the NIST-PCTS.
      */
-    char_time = (info-&gt;timeout - HZ/50) / info-&gt;port-&gt;fifosize;
+    char_time = (info-&gt;timeout - msecs_to_jiffies(20)) / info-&gt;port-&gt;fifosize;
     char_time = char_time / 5;
     if (char_time == 0)
         char_time = 1;
@@ -1521,8 +1519,7 @@ static void siccuart_wait_until_sent(str
            tty-&gt;index, jiffies,
            expire, char_time);
     while ((readb(info-&gt;port-&gt;uart_base + BL_SICC_LSR) &amp; _LSR_TX_ALL) != _LSR_TX_ALL) {
-        set_current_state(TASK_INTERRUPTIBLE);
-        schedule_timeout(char_time);
+        schedule_timeout_interruptible(char_time);
         if (signal_pending(current))
             break;
         if (timeout &amp;&amp; time_after(jiffies, expire))
@@ -1773,7 +1770,7 @@ int __init siccuart_init(void)
     for (i = 0; i &lt; SERIAL_SICC_NR; i++) {
         struct SICC_state *state = sicc_state + i;
         state-&gt;line     = i;
-        state-&gt;close_delay  = 5 * HZ / 10;
+        state-&gt;close_delay  = msecs_to_jiffies(500);
         state-&gt;closing_wait = 30 * HZ;
 	spin_lock_init(&amp;state-&gt;sicc_lock);
     }
diff -puN arch/ppc/8260_io/fcc_enet.c~ppc-fix-up-schedule_timeout-usage arch/ppc/8260_io/fcc_enet.c
--- 25/arch/ppc/8260_io/fcc_enet.c~ppc-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:36 2005
+++ 25-akpm/arch/ppc/8260_io/fcc_enet.c	Wed Aug 17 17:00:36 2005
@@ -1309,8 +1309,7 @@ static void mii_dm9161_wait(uint mii_reg
 
 	/* Davicom takes a bit to come up after a reset,
 	 * so wait here for a bit */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(timeout);
+	schedule_timeout_uninterruptible(timeout);
 }
 
 static phy_info_t phy_info_dm9161 = {
_
</pre></body></html>