[ide] setup-pci: small ide_get_or_set_dma_base() cleanup

* hwif->dma_base is set in ->init_iops() for MMIO
* if !dma_base then dma_base is really equal to zero
* remove dead code from simplex check
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 34b14183
...@@ -185,19 +185,16 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif) ...@@ -185,19 +185,16 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
second_chance_to_dma: second_chance_to_dma:
#endif /* CONFIG_BLK_DEV_IDEDMA_FORCED */ #endif /* CONFIG_BLK_DEV_IDEDMA_FORCED */
if ((hwif->mmio) && (hwif->dma_base)) if (hwif->mmio)
return hwif->dma_base; return hwif->dma_base;
if (hwif->mate && hwif->mate->dma_base) { if (hwif->mate && hwif->mate->dma_base) {
dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8); dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
} else { } else {
dma_base = (hwif->mmio) ? dma_base = pci_resource_start(dev, 4);
((unsigned long) hwif->hwif_data) :
(pci_resource_start(dev, 4));
if (!dma_base) { if (!dma_base) {
printk(KERN_ERR "%s: dma_base is invalid (0x%04lx)\n", printk(KERN_ERR "%s: dma_base is invalid\n",
hwif->cds->name, dma_base); hwif->cds->name);
dma_base = 0;
} }
} }
...@@ -251,7 +248,6 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif) ...@@ -251,7 +248,6 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
simplex_stat = hwif->INB(dma_base + 2); simplex_stat = hwif->INB(dma_base + 2);
if (simplex_stat & 0x80) { if (simplex_stat & 0x80) {
/* simplex device? */ /* simplex device? */
#if 0
/* /*
* At this point we haven't probed the drives so we can't make the * At this point we haven't probed the drives so we can't make the
* appropriate decision. Really we should defer this problem * appropriate decision. Really we should defer this problem
...@@ -259,18 +255,7 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif) ...@@ -259,18 +255,7 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
* to be the DMA end. This has to be become dynamic to handle hot * to be the DMA end. This has to be become dynamic to handle hot
* plug. * plug.
*/ */
/* Don't enable DMA on a simplex channel with no drives */ if (hwif->mate && hwif->mate->dma_base) {
if (!hwif->drives[0].present && !hwif->drives[1].present)
{
printk(KERN_INFO "%s: simplex device with no drives: DMA disabled\n",
hwif->cds->name);
dma_base = 0;
}
/* If our other channel has DMA then we cannot */
else
#endif
if(hwif->mate && hwif->mate->dma_base)
{
printk(KERN_INFO "%s: simplex device: " printk(KERN_INFO "%s: simplex device: "
"DMA disabled\n", "DMA disabled\n",
hwif->cds->name); hwif->cds->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment