Commit 8f09f4a2 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Linus Torvalds

[PATCH] ppc: fix-up schedule_timeout() usage

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.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 28faa429
...@@ -1145,8 +1145,8 @@ static int set_serial_info(struct SICC_info *info, ...@@ -1145,8 +1145,8 @@ static int set_serial_info(struct SICC_info *info,
info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) |
(info->flags & ASYNC_INTERNAL_FLAGS)); (info->flags & ASYNC_INTERNAL_FLAGS));
state->custom_divisor = new_serial.custom_divisor; state->custom_divisor = new_serial.custom_divisor;
state->close_delay = new_serial.close_delay * HZ / 100; state->close_delay = msecs_to_jiffies(10 * new_serial.close_delay);
state->closing_wait = new_serial.closing_wait * HZ / 100; state->closing_wait = msecs_to_jiffies(10 * new_serial.closing_wait);
info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
port->fifosize = new_serial.xmit_fifo_size; port->fifosize = new_serial.xmit_fifo_size;
...@@ -1465,10 +1465,8 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp) ...@@ -1465,10 +1465,8 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp)
info->event = 0; info->event = 0;
info->tty = NULL; info->tty = NULL;
if (info->blocked_open) { if (info->blocked_open) {
if (info->state->close_delay) { if (info->state->close_delay)
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(info->state->close_delay);
schedule_timeout(info->state->close_delay);
}
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
...@@ -1496,7 +1494,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1496,7 +1494,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout)
* Note: we have to use pretty tight timings here to satisfy * Note: we have to use pretty tight timings here to satisfy
* the NIST-PCTS. * the NIST-PCTS.
*/ */
char_time = (info->timeout - HZ/50) / info->port->fifosize; char_time = (info->timeout - msecs_to_jiffies(20)) / info->port->fifosize;
char_time = char_time / 5; char_time = char_time / 5;
if (char_time == 0) if (char_time == 0)
char_time = 1; char_time = 1;
...@@ -1521,8 +1519,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1521,8 +1519,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout)
tty->index, jiffies, tty->index, jiffies,
expire, char_time); expire, char_time);
while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) { while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) {
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(char_time);
schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && time_after(jiffies, expire)) if (timeout && time_after(jiffies, expire))
...@@ -1773,7 +1770,7 @@ int __init siccuart_init(void) ...@@ -1773,7 +1770,7 @@ int __init siccuart_init(void)
for (i = 0; i < SERIAL_SICC_NR; i++) { for (i = 0; i < SERIAL_SICC_NR; i++) {
struct SICC_state *state = sicc_state + i; struct SICC_state *state = sicc_state + i;
state->line = i; state->line = i;
state->close_delay = 5 * HZ / 10; state->close_delay = msecs_to_jiffies(500);
state->closing_wait = 30 * HZ; state->closing_wait = 30 * HZ;
spin_lock_init(&state->sicc_lock); spin_lock_init(&state->sicc_lock);
} }
......
...@@ -1309,8 +1309,7 @@ static void mii_dm9161_wait(uint mii_reg, struct net_device *dev) ...@@ -1309,8 +1309,7 @@ static void mii_dm9161_wait(uint mii_reg, struct net_device *dev)
/* Davicom takes a bit to come up after a reset, /* Davicom takes a bit to come up after a reset,
* so wait here for a bit */ * so wait here for a bit */
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(timeout);
schedule_timeout(timeout);
} }
static phy_info_t phy_info_dm9161 = { static phy_info_t phy_info_dm9161 = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment