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)
return ret;
} /* send_event */
#define cs_to_timeout(cs) (((cs) * HZ + 99) / 100)
static void socket_remove_drivers(struct pcmcia_socket *skt)
{
client_t *client;
......@@ -448,8 +446,7 @@ static void socket_shutdown(struct pcmcia_socket *skt)
socket_remove_drivers(skt);
skt->state &= SOCKET_INUSE|SOCKET_PRESENT;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(shutdown_delay));
msleep(shutdown_delay * 10);
skt->state &= SOCKET_INUSE;
shutdown_socket(skt);
}
......@@ -467,8 +464,7 @@ static int socket_reset(struct pcmcia_socket *skt)
skt->socket.flags &= ~SS_RESET;
skt->ops->set_socket(skt, &skt->socket);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(unreset_delay));
msleep(unreset_delay * 10);
for (i = 0; i < unreset_limit; i++) {
skt->ops->get_status(skt, &status);
......@@ -478,8 +474,7 @@ static int socket_reset(struct pcmcia_socket *skt)
if (status & SS_READY)
return CS_SUCCESS;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(unreset_check));
msleep(unreset_check * 10);
}
cs_err(skt, "time out after reset.\n");
......@@ -496,8 +491,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
if (!(status & SS_DETECT))
return CS_NO_CARD;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(initial_delay));
msleep(initial_delay * 10);
for (i = 0; i < 100; i++) {
skt->ops->get_status(skt, &status);
......@@ -507,8 +501,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
if (!(status & SS_PENDING))
break;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(10));
msleep(100);
}
if (status & SS_PENDING) {
......@@ -541,8 +534,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
/*
* Wait "vcc_settle" for the supply to stabilise.
*/
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(vcc_settle));
msleep(vcc_settle * 10);
skt->ops->get_status(skt, &status);
if (!(status & SS_POWERON)) {
......@@ -659,10 +651,8 @@ static void socket_detect_change(struct pcmcia_socket *skt)
if (!(skt->state & SOCKET_SUSPEND)) {
int status;
if (!(skt->state & SOCKET_PRESENT)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cs_to_timeout(2));
}
if (!(skt->state & SOCKET_PRESENT))
msleep(20);
skt->ops->get_status(skt, &status);
if ((skt->state & SOCKET_PRESENT) &&
......
......@@ -50,6 +50,7 @@
#include <linux/poll.h>
#include <linux/pci.h>
#include <linux/list.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <asm/atomic.h>
......@@ -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.
* We really should let the drivers themselves drive some of this..
*/
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(HZ/4);
msleep(250);
init_waitqueue_head(&s->queue);
init_waitqueue_head(&s->request);
......
......@@ -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)
return 1;
irq_hits = 0; irq_sock = sock;
__set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/100);
msleep(10);
if (irq_hits) {
free_irq(irq, i365_count_irq);
debug(2, " spurious hit!\n");
......
......@@ -10,6 +10,7 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/hardware.h>
#include <asm/irq.h>
......@@ -96,8 +97,7 @@ static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
set_h3600_egpio(IPAQ_EGPIO_OPT_ON);
clr_h3600_egpio(IPAQ_EGPIO_OPT_RESET);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ / 1000);
msleep(10);
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