Re: [PATCH 02/18] ide: use I/O ops directly in ide-dma.c
From: Sergei Shtylyov <hidden>
Date: 2008-09-08 15:48:43
Also in:
lkml
Bartlomiej Zolnierkiewicz wrote:
Use I/O ops directly in ide_dma_host_set(), ide_dma_setup(), ide_dma_start() and __ide_dma_end().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
[...]
quoted hunk ↗ jump to hunk
Index: b/drivers/ide/ide-dma.c ===================================================================--- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c@@ -376,7 +376,10 @@ void ide_dma_host_set(ide_drive_t *drive else dma_stat &= ~(1 << (5 + unit)); - hwif->OUTB(dma_stat, hwif->dma_status); + if (hwif->host_flags & IDE_HFLAG_MMIO) + writeb(dma_stat, (void __iomem *)hwif->dma_status); + else + outb(dma_stat, hwif->dma_status); } EXPORT_SYMBOL_GPL(ide_dma_host_set);@@ -470,13 +474,20 @@ int ide_dma_setup(ide_drive_t *drive)
[...]
quoted hunk ↗ jump to hunk
/* read DMA status for INTR & ERROR flags */ dma_stat = hwif->read_sff_dma_status(hwif); /* clear INTR & ERROR flags */ - hwif->OUTB(dma_stat|6, hwif->dma_status); + if (mmio) + writeb(dma_stat | 6, (void __iomem *)hwif->dma_status); + else + outb(dma_stat | 6, hwif->dma_status); + drive->waiting_for_dma = 1; return 0; }@@ -511,18 +529,31 @@ EXPORT_SYMBOL_GPL(ide_dma_start);
[...]
/* get DMA status */ dma_stat = hwif->read_sff_dma_status(hwif); - /* clear the INTR & ERROR bits */ - hwif->OUTB(dma_stat|6, hwif->dma_status); + + if (mmio) + /* clear the INTR & ERROR bits */ + writeb(dma_stat | 6, (void __iomem *)hwif->dma_status); + else + outb(dma_stat | 6, hwif->dma_status); +
Seems like the above 3 sequences are asking to be factored out into
ide_dma_write_status(); with the latter two possibly factored out into
ide_dma_clear_status(). I'm making a notch if you don't mind (or beat me to it
:-)...
MBR, Sergei