[PATCH] janitor: block/xd: replace schedule_timeout() with msleep()/msleep_interruptible()
Use msleep() or msleep_interruptible() [as appropriate] instead of schedule_timeout() to gurantee the task delays as expected. As a result changed the units of the timeout variable from jiffies to msecs. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Maximilian Attems <janitor@sternwelten.at> Signed-off-by: Domen Puncer <domen@coderock.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
31a34571e5
commit
f6a2f3404a
|
@ -47,6 +47,7 @@
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/blkdev.h>
|
#include <linux/blkdev.h>
|
||||||
#include <linux/blkpg.h>
|
#include <linux/blkpg.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
@ -62,7 +63,7 @@ static int xd[5] = { -1,-1,-1,-1, };
|
||||||
|
|
||||||
#define XD_DONT_USE_DMA 0 /* Initial value. may be overriden using
|
#define XD_DONT_USE_DMA 0 /* Initial value. may be overriden using
|
||||||
"nodma" module option */
|
"nodma" module option */
|
||||||
#define XD_INIT_DISK_DELAY (30*HZ/1000) /* 30 ms delay during disk initialization */
|
#define XD_INIT_DISK_DELAY (30) /* 30 ms delay during disk initialization */
|
||||||
|
|
||||||
/* Above may need to be increased if a problem with the 2nd drive detection
|
/* Above may need to be increased if a problem with the 2nd drive detection
|
||||||
(ST11M controller) or resetting a controller (WD) appears */
|
(ST11M controller) or resetting a controller (WD) appears */
|
||||||
|
@ -633,14 +634,12 @@ static u_char __init xd_initdrives (void (*init_drive)(u_char drive))
|
||||||
for (i = 0; i < XD_MAXDRIVES; i++) {
|
for (i = 0; i < XD_MAXDRIVES; i++) {
|
||||||
xd_build(cmdblk,CMD_TESTREADY,i,0,0,0,0,0);
|
xd_build(cmdblk,CMD_TESTREADY,i,0,0,0,0,0);
|
||||||
if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT*8)) {
|
if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT*8)) {
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
msleep_interruptible(XD_INIT_DISK_DELAY);
|
||||||
schedule_timeout(XD_INIT_DISK_DELAY);
|
|
||||||
|
|
||||||
init_drive(count);
|
init_drive(count);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
msleep_interruptible(XD_INIT_DISK_DELAY);
|
||||||
schedule_timeout(XD_INIT_DISK_DELAY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (count);
|
return (count);
|
||||||
|
@ -761,8 +760,7 @@ static void __init xd_wd_init_controller (unsigned int address)
|
||||||
|
|
||||||
outb(0,XD_RESET); /* reset the controller */
|
outb(0,XD_RESET); /* reset the controller */
|
||||||
|
|
||||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
msleep(XD_INIT_DISK_DELAY);
|
||||||
schedule_timeout(XD_INIT_DISK_DELAY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init xd_wd_init_drive (u_char drive)
|
static void __init xd_wd_init_drive (u_char drive)
|
||||||
|
@ -936,8 +934,7 @@ If you need non-standard settings use the xd=... command */
|
||||||
xd_maxsectors = 0x01;
|
xd_maxsectors = 0x01;
|
||||||
outb(0,XD_RESET); /* reset the controller */
|
outb(0,XD_RESET); /* reset the controller */
|
||||||
|
|
||||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
msleep(XD_INIT_DISK_DELAY);
|
||||||
schedule_timeout(XD_INIT_DISK_DELAY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init xd_xebec_init_drive (u_char drive)
|
static void __init xd_xebec_init_drive (u_char drive)
|
||||||
|
|
Loading…
Reference in New Issue