diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-11-07 04:01:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:56 -0500 |
commit | 8f09f4a25a927080e1fa1331735c3d1b5664866b (patch) | |
tree | 976ed857b88e3dced0bf277f50fd4c8d371fe885 /arch/ppc | |
parent | 28faa4298ec069d1de4f54597f963be8ef35e706 (diff) |
[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: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/4xx_io/serial_sicc.c | 17 | ||||
-rw-r--r-- | arch/ppc/8260_io/fcc_enet.c | 3 |
2 files changed, 8 insertions, 12 deletions
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c index e95c48d57571..84d96b857e4a 100644 --- a/arch/ppc/4xx_io/serial_sicc.c +++ b/arch/ppc/4xx_io/serial_sicc.c | |||
@@ -1145,8 +1145,8 @@ static int set_serial_info(struct SICC_info *info, | |||
1145 | info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | | 1145 | info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | |
1146 | (info->flags & ASYNC_INTERNAL_FLAGS)); | 1146 | (info->flags & ASYNC_INTERNAL_FLAGS)); |
1147 | state->custom_divisor = new_serial.custom_divisor; | 1147 | state->custom_divisor = new_serial.custom_divisor; |
1148 | state->close_delay = new_serial.close_delay * HZ / 100; | 1148 | state->close_delay = msecs_to_jiffies(10 * new_serial.close_delay); |
1149 | state->closing_wait = new_serial.closing_wait * HZ / 100; | 1149 | state->closing_wait = msecs_to_jiffies(10 * new_serial.closing_wait); |
1150 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 1150 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1151 | port->fifosize = new_serial.xmit_fifo_size; | 1151 | port->fifosize = new_serial.xmit_fifo_size; |
1152 | 1152 | ||
@@ -1465,10 +1465,8 @@ static void siccuart_close(struct tty_struct *tty, struct file *filp) | |||
1465 | info->event = 0; | 1465 | info->event = 0; |
1466 | info->tty = NULL; | 1466 | info->tty = NULL; |
1467 | if (info->blocked_open) { | 1467 | if (info->blocked_open) { |
1468 | if (info->state->close_delay) { | 1468 | if (info->state->close_delay) |
1469 | set_current_state(TASK_INTERRUPTIBLE); | 1469 | schedule_timeout_interruptible(info->state->close_delay); |
1470 | schedule_timeout(info->state->close_delay); | ||
1471 | } | ||
1472 | wake_up_interruptible(&info->open_wait); | 1470 | wake_up_interruptible(&info->open_wait); |
1473 | } | 1471 | } |
1474 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1472 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
@@ -1496,7 +1494,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1496 | * Note: we have to use pretty tight timings here to satisfy | 1494 | * Note: we have to use pretty tight timings here to satisfy |
1497 | * the NIST-PCTS. | 1495 | * the NIST-PCTS. |
1498 | */ | 1496 | */ |
1499 | char_time = (info->timeout - HZ/50) / info->port->fifosize; | 1497 | char_time = (info->timeout - msecs_to_jiffies(20)) / info->port->fifosize; |
1500 | char_time = char_time / 5; | 1498 | char_time = char_time / 5; |
1501 | if (char_time == 0) | 1499 | if (char_time == 0) |
1502 | char_time = 1; | 1500 | char_time = 1; |
@@ -1521,8 +1519,7 @@ static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1521 | tty->index, jiffies, | 1519 | tty->index, jiffies, |
1522 | expire, char_time); | 1520 | expire, char_time); |
1523 | while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) { | 1521 | while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) { |
1524 | set_current_state(TASK_INTERRUPTIBLE); | 1522 | schedule_timeout_interruptible(char_time); |
1525 | schedule_timeout(char_time); | ||
1526 | if (signal_pending(current)) | 1523 | if (signal_pending(current)) |
1527 | break; | 1524 | break; |
1528 | if (timeout && time_after(jiffies, expire)) | 1525 | if (timeout && time_after(jiffies, expire)) |
@@ -1773,7 +1770,7 @@ int __init siccuart_init(void) | |||
1773 | for (i = 0; i < SERIAL_SICC_NR; i++) { | 1770 | for (i = 0; i < SERIAL_SICC_NR; i++) { |
1774 | struct SICC_state *state = sicc_state + i; | 1771 | struct SICC_state *state = sicc_state + i; |
1775 | state->line = i; | 1772 | state->line = i; |
1776 | state->close_delay = 5 * HZ / 10; | 1773 | state->close_delay = msecs_to_jiffies(500); |
1777 | state->closing_wait = 30 * HZ; | 1774 | state->closing_wait = 30 * HZ; |
1778 | spin_lock_init(&state->sicc_lock); | 1775 | spin_lock_init(&state->sicc_lock); |
1779 | } | 1776 | } |
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c index 2086c6ad1147..4edeede9ccfd 100644 --- a/arch/ppc/8260_io/fcc_enet.c +++ b/arch/ppc/8260_io/fcc_enet.c | |||
@@ -1309,8 +1309,7 @@ static void mii_dm9161_wait(uint mii_reg, struct net_device *dev) | |||
1309 | 1309 | ||
1310 | /* Davicom takes a bit to come up after a reset, | 1310 | /* Davicom takes a bit to come up after a reset, |
1311 | * so wait here for a bit */ | 1311 | * so wait here for a bit */ |
1312 | set_current_state(TASK_UNINTERRUPTIBLE); | 1312 | schedule_timeout_uninterruptible(timeout); |
1313 | schedule_timeout(timeout); | ||
1314 | } | 1313 | } |
1315 | 1314 | ||
1316 | static phy_info_t phy_info_dm9161 = { | 1315 | static phy_info_t phy_info_dm9161 = { |