Skip to content

Commit

Permalink
floppy: tolerate DMA channel unavailability
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Beulich authored and Linus Torvalds committed Oct 17, 2007
1 parent e98c320 commit 2e9c47c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 2e9c47c

Please sign in to comment.