From: Ingo Molnar <mingo@elte.hu>
To: Mikael Pettersson <mikpe@it.uu.se>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [patch] floppy: suspend/resume fix
Date: Sun, 12 Nov 2006 16:47:12 +0100 [thread overview]
Message-ID: <20061112154711.GA14543@elte.hu> (raw)
In-Reply-To: <200611112048.kABKmg2u002509@harpo.it.uu.se>
* Mikael Pettersson <mikpe@it.uu.se> wrote:
> On my old Dell Latitude laptop, the first access to the floppy after
> having resumed from APM suspend fails miserably and generates these
> kernel messages (from 2.6.19-rc5):
[...]
> It's only the first post-resume access that triggers this failure,
> subsequent accesses do work.
>
> I've traced the cause to Ingo's lockdep patch in 2.6.18-rc1 (see
> below): reverting it makes the floppy work after resume again.
could you check the patch below? I had to add a platform driver to
floppy.c to get suspend/resume callbacks, but otherwise it's relatively
straightforward.
Ingo
----------------------->
Subject: [patch] floppy: suspend/resume fix
From: Ingo Molnar <mingo@elte.hu>
introduce a floppy platform-driver and suspend/resume ops to
stop/start the floppy driver. Bug reported by Mikael Pettersson.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
drivers/block/floppy.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
Index: linux/drivers/block/floppy.c
===================================================================
--- linux.orig/drivers/block/floppy.c
+++ linux/drivers/block/floppy.c
@@ -4157,6 +4157,28 @@ static void floppy_device_release(struct
complete(&device_release);
}
+static int floppy_suspend(struct platform_device *dev, pm_message_t state)
+{
+ floppy_release_irq_and_dma();
+
+ return 0;
+}
+
+static int floppy_resume(struct platform_device *dev)
+{
+ floppy_grab_irq_and_dma();
+
+ return 0;
+}
+
+static struct platform_driver floppy_driver = {
+ .suspend = floppy_suspend,
+ .resume = floppy_resume,
+ .driver = {
+ .name = "floppy",
+ },
+};
+
static struct platform_device floppy_device[N_DRIVE];
static struct kobject *floppy_find(dev_t dev, int *part, void *data)
@@ -4205,10 +4227,14 @@ static int __init floppy_init(void)
if (err)
goto out_put_disk;
+ err = platform_driver_register(&floppy_driver);
+ if (err)
+ goto out_unreg_blkdev;
+
floppy_queue = blk_init_queue(do_fd_request, &floppy_lock);
if (!floppy_queue) {
err = -ENOMEM;
- goto out_unreg_blkdev;
+ goto out_unreg_driver;
}
blk_queue_max_sectors(floppy_queue, 64);
@@ -4352,6 +4378,8 @@ out_flush_work:
out_unreg_region:
blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
blk_cleanup_queue(floppy_queue);
+out_unreg_driver:
+ platform_driver_unregister(&floppy_driver);
out_unreg_blkdev:
unregister_blkdev(FLOPPY_MAJOR, "fd");
out_put_disk:
@@ -4543,6 +4571,7 @@ void cleanup_module(void)
init_completion(&device_release);
blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
unregister_blkdev(FLOPPY_MAJOR, "fd");
+ platform_driver_unregister(&floppy_driver);
for (drive = 0; drive < N_DRIVE; drive++) {
del_timer_sync(&motor_off_timer[drive]);
next prev parent reply other threads:[~2006-11-12 15:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-11 20:48 [BUG] floppy: broken after resume due to 2.6.18-rc1 lockdep changes Mikael Pettersson
2006-11-12 15:47 ` Ingo Molnar [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-11-12 17:53 [patch] floppy: suspend/resume fix Mikael Pettersson
2006-11-12 18:09 ` Ingo Molnar
2006-11-12 19:30 ` Andrew Morton
2006-11-12 20:35 ` Arjan van de Ven
2006-11-12 19:40 ` Russell King
2006-11-12 20:47 Mikael Pettersson
2006-11-12 21:29 ` Russell King
2006-11-12 22:03 ` Ingo Molnar
2006-11-12 23:54 ` Russell King
2006-11-14 11:09 ` Pavel Machek
2006-11-14 16:34 ` Lee Revell
2006-11-15 20:24 ` Pavel Machek
2006-11-15 20:34 ` Lee Revell
2006-11-15 20:49 ` Alan
2006-11-15 20:49 ` Pavel Machek
2006-11-15 21:03 ` Rafael J. Wysocki
2006-11-15 21:14 ` Arjan van de Ven
2006-11-16 12:38 ` Russell King
2006-11-15 18:46 ` Ingo Molnar
[not found] <7grMO-2YO-55@gated-at.bofh.it>
[not found] ` <7gs69-46A-37@gated-at.bofh.it>
[not found] ` <7gtvd-7xg-23@gated-at.bofh.it>
2006-11-12 21:44 ` Bodo Eggert
2006-11-14 11:05 ` Pavel Machek
2006-11-12 22:40 Mikael Pettersson
2006-11-12 23:58 ` Russell King
2006-11-15 18:53 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061112154711.GA14543@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@it.uu.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.