Commit 46e03c6c authored by Russell King's avatar Russell King

[PCMCIA] replace schedule_timeout() with msleep()

From: <janitor@sternwelten.at>

Remove unnecessary cs_to_timeout() macro.  Use msleep() instead of
schedule_timeout() to guarantee the task delays for the desired
time.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarMaximilian Attems <janitor@sternwelten.at>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarRussell King <rmk@arm.linux.org.uk>
parent 797713b4
...@@ -427,8 +427,6 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority) ...@@ -427,8 +427,6 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
return ret; return ret;
} /* send_event */ } /* send_event */
#define cs_to_timeout(cs) (((cs) * HZ + 99) / 100)
static void socket_remove_drivers(struct pcmcia_socket *skt) static void socket_remove_drivers(struct pcmcia_socket *skt)
{ {
client_t *client; client_t *client;
...@@ -448,8 +446,7 @@ static void socket_shutdown(struct pcmcia_socket *skt) ...@@ -448,8 +446,7 @@ static void socket_shutdown(struct pcmcia_socket *skt)
socket_remove_drivers(skt); socket_remove_drivers(skt);
skt->state &= SOCKET_INUSE|SOCKET_PRESENT; skt->state &= SOCKET_INUSE|SOCKET_PRESENT;
set_current_state(TASK_UNINTERRUPTIBLE); msleep(shutdown_delay * 10);
schedule_timeout(cs_to_timeout(shutdown_delay));
skt->state &= SOCKET_INUSE; skt->state &= SOCKET_INUSE;
shutdown_socket(skt); shutdown_socket(skt);
} }
...@@ -467,8 +464,7 @@ static int socket_reset(struct pcmcia_socket *skt) ...@@ -467,8 +464,7 @@ static int socket_reset(struct pcmcia_socket *skt)
skt->socket.flags &= ~SS_RESET; skt->socket.flags &= ~SS_RESET;
skt->ops->set_socket(skt, &skt->socket); skt->ops->set_socket(skt, &skt->socket);
set_current_state(TASK_UNINTERRUPTIBLE); msleep(unreset_delay * 10);
schedule_timeout(cs_to_timeout(unreset_delay));
for (i = 0; i < unreset_limit; i++) { for (i = 0; i < unreset_limit; i++) {
skt->ops->get_status(skt, &status); skt->ops->get_status(skt, &status);
...@@ -478,8 +474,7 @@ static int socket_reset(struct pcmcia_socket *skt) ...@@ -478,8 +474,7 @@ static int socket_reset(struct pcmcia_socket *skt)
if (status & SS_READY) if (status & SS_READY)
return CS_SUCCESS; return CS_SUCCESS;
set_current_state(TASK_UNINTERRUPTIBLE); msleep(unreset_check * 10);
schedule_timeout(cs_to_timeout(unreset_check));
} }
cs_err(skt, "time out after reset.\n"); cs_err(skt, "time out after reset.\n");
...@@ -496,8 +491,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) ...@@ -496,8 +491,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
if (!(status & SS_DETECT)) if (!(status & SS_DETECT))
return CS_NO_CARD; return CS_NO_CARD;
set_current_state(TASK_UNINTERRUPTIBLE); msleep(initial_delay * 10);
schedule_timeout(cs_to_timeout(initial_delay));
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
skt->ops->get_status(skt, &status); skt->ops->get_status(skt, &status);
...@@ -507,8 +501,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) ...@@ -507,8 +501,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
if (!(status & SS_PENDING)) if (!(status & SS_PENDING))
break; break;
set_current_state(TASK_UNINTERRUPTIBLE); msleep(100);
schedule_timeout(cs_to_timeout(10));
} }
if (status & SS_PENDING) { if (status & SS_PENDING) {
...@@ -541,8 +534,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) ...@@ -541,8 +534,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
/* /*
* Wait "vcc_settle" for the supply to stabilise. * Wait "vcc_settle" for the supply to stabilise.
*/ */
set_current_state(TASK_UNINTERRUPTIBLE); msleep(vcc_settle * 10);
schedule_timeout(cs_to_timeout(vcc_settle));
skt->ops->get_status(skt, &status); skt->ops->get_status(skt, &status);
if (!(status & SS_POWERON)) { if (!(status & SS_POWERON)) {
...@@ -659,10 +651,8 @@ static void socket_detect_change(struct pcmcia_socket *skt) ...@@ -659,10 +651,8 @@ static void socket_detect_change(struct pcmcia_socket *skt)
if (!(skt->state & SOCKET_SUSPEND)) { if (!(skt->state & SOCKET_SUSPEND)) {
int status; int status;
if (!(skt->state & SOCKET_PRESENT)) { if (!(skt->state & SOCKET_PRESENT))
set_current_state(TASK_UNINTERRUPTIBLE); msleep(20);
schedule_timeout(cs_to_timeout(2));
}
skt->ops->get_status(skt, &status); skt->ops->get_status(skt, &status);
if ((skt->state & SOCKET_PRESENT) && if ((skt->state & SOCKET_PRESENT) &&
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/delay.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -1080,8 +1081,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) ...@@ -1080,8 +1081,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev)
* Ugly. But we want to wait for the socket threads to have started up. * Ugly. But we want to wait for the socket threads to have started up.
* We really should let the drivers themselves drive some of this.. * We really should let the drivers themselves drive some of this..
*/ */
current->state = TASK_INTERRUPTIBLE; msleep(250);
schedule_timeout(HZ/4);
init_waitqueue_head(&s->queue); init_waitqueue_head(&s->queue);
init_waitqueue_head(&s->request); init_waitqueue_head(&s->request);
......
...@@ -513,8 +513,7 @@ static u_int __init test_irq(u_short sock, int irq) ...@@ -513,8 +513,7 @@ static u_int __init test_irq(u_short sock, int irq)
if (request_irq(irq, i365_count_irq, 0, "scan", i365_count_irq) != 0) if (request_irq(irq, i365_count_irq, 0, "scan", i365_count_irq) != 0)
return 1; return 1;
irq_hits = 0; irq_sock = sock; irq_hits = 0; irq_sock = sock;
__set_current_state(TASK_UNINTERRUPTIBLE); msleep(10);
schedule_timeout(HZ/100);
if (irq_hits) { if (irq_hits) {
free_irq(irq, i365_count_irq); free_irq(irq, i365_count_irq);
debug(2, " spurious hit!\n"); debug(2, " spurious hit!\n");
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -96,8 +97,7 @@ static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt) ...@@ -96,8 +97,7 @@ static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
set_h3600_egpio(IPAQ_EGPIO_OPT_ON); set_h3600_egpio(IPAQ_EGPIO_OPT_ON);
clr_h3600_egpio(IPAQ_EGPIO_OPT_RESET); clr_h3600_egpio(IPAQ_EGPIO_OPT_RESET);
set_current_state(TASK_UNINTERRUPTIBLE); msleep(10);
schedule_timeout(10*HZ / 1000);
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs)); soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
} }
......
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