ide: cleanup ide_set_dma()
* ->dma_off_quietly is always called before ide_set_dma() so the call can be moved inside ide_set_dma(). * ide_dma_check() doesn't touch hardware so ->dma_off_quietly call for 'rc == -1' case is redundant, remove it. * '0' and '-1' are the only values returned by ide_dma_check() so remove dead code for other cases. There should be no functionality changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
@@ -827,22 +827,19 @@ int ide_set_dma(ide_drive_t *drive)
|
|||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = ide_dma_check(drive);
|
/*
|
||||||
|
* Force DMAing for the beginning of the check.
|
||||||
switch(rc) {
|
* Some chipsets appear to do interesting
|
||||||
case -1: /* DMA needs to be disabled */
|
* things, if not checked and cleared.
|
||||||
|
* PARANOIA!!!
|
||||||
|
*/
|
||||||
hwif->dma_off_quietly(drive);
|
hwif->dma_off_quietly(drive);
|
||||||
return -1;
|
|
||||||
case 0: /* DMA needs to be enabled */
|
|
||||||
return hwif->ide_dma_on(drive);
|
|
||||||
case 1: /* DMA setting cannot be changed */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
rc = ide_dma_check(drive);
|
||||||
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
return hwif->ide_dma_on(drive);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
|
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
|
||||||
|
@@ -221,7 +221,6 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
|
|||||||
*/
|
*/
|
||||||
if (drive->hwif->ide_dma_on == NULL)
|
if (drive->hwif->ide_dma_on == NULL)
|
||||||
break;
|
break;
|
||||||
drive->hwif->dma_off_quietly(drive);
|
|
||||||
/*
|
/*
|
||||||
* TODO: respect ->using_dma setting
|
* TODO: respect ->using_dma setting
|
||||||
*/
|
*/
|
||||||
|
@@ -833,18 +833,10 @@ static void probe_hwif(ide_hwif_t *hwif)
|
|||||||
|
|
||||||
drive->nice1 = 1;
|
drive->nice1 = 1;
|
||||||
|
|
||||||
if (hwif->ide_dma_on) {
|
if (hwif->ide_dma_on)
|
||||||
/*
|
|
||||||
* Force DMAing for the beginning of the check.
|
|
||||||
* Some chipsets appear to do interesting
|
|
||||||
* things, if not checked and cleared.
|
|
||||||
* PARANOIA!!!
|
|
||||||
*/
|
|
||||||
hwif->dma_off_quietly(drive);
|
|
||||||
ide_set_dma(drive);
|
ide_set_dma(drive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (unit = 0; unit < MAX_DRIVES; ++unit) {
|
for (unit = 0; unit < MAX_DRIVES; ++unit) {
|
||||||
ide_drive_t *drive = &hwif->drives[unit];
|
ide_drive_t *drive = &hwif->drives[unit];
|
||||||
|
@@ -851,7 +851,6 @@ int set_using_dma(ide_drive_t *drive, int arg)
|
|||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
hwif->dma_off_quietly(drive);
|
|
||||||
if (ide_set_dma(drive))
|
if (ide_set_dma(drive))
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
} else
|
} else
|
||||||
|
Reference in New Issue
Block a user