Skip to content

Commit

Permalink
floppy: Run floppy initialization asynchronous
Browse files Browse the repository at this point in the history
floppy_init is quite slow, 3s on my test system to determine
that there is no floppy. Run it asynchronous to the other
init calls to improve boot time.

[jkosina@suse.cz: fix modular build]

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Andi Kleen authored and Jiri Kosina committed Jul 4, 2012
1 parent a70f35a commit 0cc15d0
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ static int print_unex = 1;
#include <linux/mutex.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/async.h>

/*
* PS/2 floppies have much slower step rates than regular floppies.
Expand Down Expand Up @@ -4122,7 +4123,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
return get_disk(disks[drive]);
}

static int __init floppy_init(void)
static int __init do_floppy_init(void)
{
int i, unit, drive;
int err, dr;
Expand Down Expand Up @@ -4337,6 +4338,24 @@ static int __init floppy_init(void)
return err;
}

#ifndef MODULE
static __init void floppy_async_init(void *data, async_cookie_t cookie)
{
do_floppy_init();
}
#endif

static int __init floppy_init(void)
{
#ifdef MODULE
return do_floppy_init();
#else
/* Don't hold up the bootup by the floppy initialization */
async_schedule(floppy_async_init, NULL);
return 0;
#endif
}

static const struct io_region {
int offset;
int size;
Expand Down

0 comments on commit 0cc15d0

Please sign in to comment.