diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2009-06-10 15:57:09 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-06-10 17:07:16 -0400 |
commit | 5e50b9ef975219304cc91d601530994861585bfe (patch) | |
tree | e5fe8ca9b5262c90290f66182615f7e284be8754 /drivers | |
parent | 1adbee50fd6fce5af4feb34d2db93cfe4d2066a4 (diff) |
floppy: fix hibernation
Based on Ingo Molnar's patch from 2006, this makes the floppy work after
resume from hibernation, at least on my machine.
This fix resets the floppy controller on resume. It was experimentally
determined to bring the controller back to life - we don't really know why
it works.
floppy_init() does the same thing at boot/modprobe time.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/floppy.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 90877fee0ee0..862b40c90181 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4148,6 +4148,24 @@ static void floppy_device_release(struct device *dev) | |||
4148 | { | 4148 | { |
4149 | } | 4149 | } |
4150 | 4150 | ||
4151 | static int floppy_resume(struct platform_device *dev) | ||
4152 | { | ||
4153 | int fdc; | ||
4154 | |||
4155 | for (fdc = 0; fdc < N_FDC; fdc++) | ||
4156 | if (FDCS->address != -1) | ||
4157 | user_reset_fdc(-1, FD_RESET_ALWAYS, 0); | ||
4158 | |||
4159 | return 0; | ||
4160 | } | ||
4161 | |||
4162 | static struct platform_driver floppy_driver = { | ||
4163 | .resume = floppy_resume, | ||
4164 | .driver = { | ||
4165 | .name = "floppy", | ||
4166 | }, | ||
4167 | }; | ||
4168 | |||
4151 | static struct platform_device floppy_device[N_DRIVE]; | 4169 | static struct platform_device floppy_device[N_DRIVE]; |
4152 | 4170 | ||
4153 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) | 4171 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) |
@@ -4196,10 +4214,14 @@ static int __init floppy_init(void) | |||
4196 | if (err) | 4214 | if (err) |
4197 | goto out_put_disk; | 4215 | goto out_put_disk; |
4198 | 4216 | ||
4217 | err = platform_driver_register(&floppy_driver); | ||
4218 | if (err) | ||
4219 | goto out_unreg_blkdev; | ||
4220 | |||
4199 | floppy_queue = blk_init_queue(do_fd_request, &floppy_lock); | 4221 | floppy_queue = blk_init_queue(do_fd_request, &floppy_lock); |
4200 | if (!floppy_queue) { | 4222 | if (!floppy_queue) { |
4201 | err = -ENOMEM; | 4223 | err = -ENOMEM; |
4202 | goto out_unreg_blkdev; | 4224 | goto out_unreg_driver; |
4203 | } | 4225 | } |
4204 | blk_queue_max_sectors(floppy_queue, 64); | 4226 | blk_queue_max_sectors(floppy_queue, 64); |
4205 | 4227 | ||
@@ -4346,6 +4368,8 @@ out_flush_work: | |||
4346 | out_unreg_region: | 4368 | out_unreg_region: |
4347 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4369 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4348 | blk_cleanup_queue(floppy_queue); | 4370 | blk_cleanup_queue(floppy_queue); |
4371 | out_unreg_driver: | ||
4372 | platform_driver_unregister(&floppy_driver); | ||
4349 | out_unreg_blkdev: | 4373 | out_unreg_blkdev: |
4350 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4374 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4351 | out_put_disk: | 4375 | out_put_disk: |
@@ -4566,6 +4590,7 @@ static void __exit floppy_module_exit(void) | |||
4566 | 4590 | ||
4567 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4591 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4568 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4592 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4593 | platform_driver_unregister(&floppy_driver); | ||
4569 | 4594 | ||
4570 | for (drive = 0; drive < N_DRIVE; drive++) { | 4595 | for (drive = 0; drive < N_DRIVE; drive++) { |
4571 | del_timer_sync(&motor_off_timer[drive]); | 4596 | del_timer_sync(&motor_off_timer[drive]); |