summaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-10-17 08:27:32 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 17:42:55 +0200
commit2e9c47cd4d451c57868c898672802eec9867ae1e (patch)
treeac2d7169107c579086bcaa8731ca3d9812776e59 /drivers/block/floppy.c
parentMove PREEMPT_NOTIFIERS into an always-included Kconfig (diff)
downloadlinux-2e9c47cd4d451c57868c898672802eec9867ae1e.tar.xz
linux-2e9c47cd4d451c57868c898672802eec9867ae1e.zip
floppy: tolerate DMA channel unavailability
The floppy driver is already written to be able to operate in virtual DMA mode. Thus it can easily be adjusted to tolerate failure from fd_request_dma() as long as virtual DMA mode is not disallowed. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 80483aac4cc9..72803a3585ff 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4388,11 +4388,15 @@ static int floppy_grab_irq_and_dma(void)
if (fd_request_dma()) {
DPRINT("Unable to grab DMA%d for the floppy driver\n",
FLOPPY_DMA);
- fd_free_irq();
- spin_lock_irqsave(&floppy_usage_lock, flags);
- usage_count--;
- spin_unlock_irqrestore(&floppy_usage_lock, flags);
- return -1;
+ if (can_use_virtual_dma & 2)
+ use_virtual_dma = can_use_virtual_dma = 1;
+ if (!(can_use_virtual_dma & 1)) {
+ fd_free_irq();
+ spin_lock_irqsave(&floppy_usage_lock, flags);
+ usage_count--;
+ spin_unlock_irqrestore(&floppy_usage_lock, flags);
+ return -1;
+ }
}
for (fdc = 0; fdc < N_FDC; fdc++) {