diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-09-10 03:27:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 13:06:38 -0400 |
commit | 7b4ccf8db4c1dc343ad5d6ed19240bbc3b5f945f (patch) | |
tree | 5e73fbba733a6e77f157c4022ee26b8c56b7410e /drivers | |
parent | da4cd8dfe18ee901b880f94ca0fa79d5cc1cd0eb (diff) |
[PATCH] parport: fix-up schedule_timeout() usage
Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size. Also use
human-time to jiffies units conversion functions rather than direct HZ
division to avoid rounding issues.
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/parport/ieee1284.c | 7 | ||||
-rw-r--r-- | drivers/parport/ieee1284_ops.c | 10 | ||||
-rw-r--r-- | drivers/parport/parport_pc.c | 3 |
3 files changed, 8 insertions, 12 deletions
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c index 694bae162fed..5b887ba5aaf9 100644 --- a/drivers/parport/ieee1284.c +++ b/drivers/parport/ieee1284.c | |||
@@ -196,7 +196,7 @@ int parport_wait_peripheral(struct parport *port, | |||
196 | return 1; | 196 | return 1; |
197 | 197 | ||
198 | /* 40ms of slow polling. */ | 198 | /* 40ms of slow polling. */ |
199 | deadline = jiffies + (HZ + 24) / 25; | 199 | deadline = jiffies + msecs_to_jiffies(40); |
200 | while (time_before (jiffies, deadline)) { | 200 | while (time_before (jiffies, deadline)) { |
201 | int ret; | 201 | int ret; |
202 | 202 | ||
@@ -205,7 +205,7 @@ int parport_wait_peripheral(struct parport *port, | |||
205 | 205 | ||
206 | /* Wait for 10ms (or until an interrupt occurs if | 206 | /* Wait for 10ms (or until an interrupt occurs if |
207 | * the handler is set) */ | 207 | * the handler is set) */ |
208 | if ((ret = parport_wait_event (port, (HZ + 99) / 100)) < 0) | 208 | if ((ret = parport_wait_event (port, msecs_to_jiffies(10))) < 0) |
209 | return ret; | 209 | return ret; |
210 | 210 | ||
211 | status = parport_read_status (port); | 211 | status = parport_read_status (port); |
@@ -216,8 +216,7 @@ int parport_wait_peripheral(struct parport *port, | |||
216 | /* parport_wait_event didn't time out, but the | 216 | /* parport_wait_event didn't time out, but the |
217 | * peripheral wasn't actually ready either. | 217 | * peripheral wasn't actually ready either. |
218 | * Wait for another 10ms. */ | 218 | * Wait for another 10ms. */ |
219 | __set_current_state (TASK_INTERRUPTIBLE); | 219 | schedule_timeout_interruptible(msecs_to_jiffies(10)); |
220 | schedule_timeout ((HZ+ 99) / 100); | ||
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c index 6624278c6ed8..ce1e2aad8b10 100644 --- a/drivers/parport/ieee1284_ops.c +++ b/drivers/parport/ieee1284_ops.c | |||
@@ -60,7 +60,7 @@ size_t parport_ieee1284_write_compat (struct parport *port, | |||
60 | parport_data_forward (port); | 60 | parport_data_forward (port); |
61 | while (count < len) { | 61 | while (count < len) { |
62 | unsigned long expire = jiffies + dev->timeout; | 62 | unsigned long expire = jiffies + dev->timeout; |
63 | long wait = (HZ + 99) / 100; | 63 | long wait = msecs_to_jiffies(10); |
64 | unsigned char mask = (PARPORT_STATUS_ERROR | 64 | unsigned char mask = (PARPORT_STATUS_ERROR |
65 | | PARPORT_STATUS_BUSY); | 65 | | PARPORT_STATUS_BUSY); |
66 | unsigned char val = (PARPORT_STATUS_ERROR | 66 | unsigned char val = (PARPORT_STATUS_ERROR |
@@ -97,8 +97,7 @@ size_t parport_ieee1284_write_compat (struct parport *port, | |||
97 | our interrupt handler called. */ | 97 | our interrupt handler called. */ |
98 | if (count && no_irq) { | 98 | if (count && no_irq) { |
99 | parport_release (dev); | 99 | parport_release (dev); |
100 | __set_current_state (TASK_INTERRUPTIBLE); | 100 | schedule_timeout_interruptible(wait); |
101 | schedule_timeout (wait); | ||
102 | parport_claim_or_block (dev); | 101 | parport_claim_or_block (dev); |
103 | } | 102 | } |
104 | else | 103 | else |
@@ -542,13 +541,12 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port, | |||
542 | /* Yield the port for a while. */ | 541 | /* Yield the port for a while. */ |
543 | if (count && dev->port->irq != PARPORT_IRQ_NONE) { | 542 | if (count && dev->port->irq != PARPORT_IRQ_NONE) { |
544 | parport_release (dev); | 543 | parport_release (dev); |
545 | __set_current_state (TASK_INTERRUPTIBLE); | 544 | schedule_timeout_interruptible(msecs_to_jiffies(40)); |
546 | schedule_timeout ((HZ + 24) / 25); | ||
547 | parport_claim_or_block (dev); | 545 | parport_claim_or_block (dev); |
548 | } | 546 | } |
549 | else | 547 | else |
550 | /* We must have the device claimed here. */ | 548 | /* We must have the device claimed here. */ |
551 | parport_wait_event (port, (HZ + 24) / 25); | 549 | parport_wait_event (port, msecs_to_jiffies(40)); |
552 | 550 | ||
553 | /* Is there a signal pending? */ | 551 | /* Is there a signal pending? */ |
554 | if (signal_pending (current)) | 552 | if (signal_pending (current)) |
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 1b938bb9be3c..c6493ad7c0c8 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -173,8 +173,7 @@ static int change_mode(struct parport *p, int m) | |||
173 | if (time_after_eq (jiffies, expire)) | 173 | if (time_after_eq (jiffies, expire)) |
174 | /* The FIFO is stuck. */ | 174 | /* The FIFO is stuck. */ |
175 | return -EBUSY; | 175 | return -EBUSY; |
176 | __set_current_state (TASK_INTERRUPTIBLE); | 176 | schedule_timeout_interruptible(msecs_to_jiffies(10)); |
177 | schedule_timeout ((HZ + 99) / 100); | ||
178 | if (signal_pending (current)) | 177 | if (signal_pending (current)) |
179 | break; | 178 | break; |
180 | } | 179 | } |