diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:19 -0500 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:19 -0500 |
| commit | 7b905994ce0bd332afc5ebc30ce9afa60d23c6e2 (patch) | |
| tree | 4f0f25616d816087e0022dce95f996c99c8dcc6e | |
| parent | 23b1bd459c9e8a925381960f0b69ac85468c3af1 (diff) | |
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>
| -rw-r--r-- | drivers/ide/ide-dma.c | 25 | ||||
| -rw-r--r-- | drivers/ide/ide-io.c | 1 | ||||
| -rw-r--r-- | drivers/ide/ide-probe.c | 10 | ||||
| -rw-r--r-- | drivers/ide/ide.c | 1 |
4 files changed, 12 insertions, 25 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 7568c3e81f2f..01036305d6fc 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
| @@ -827,22 +827,19 @@ int ide_set_dma(ide_drive_t *drive) | |||
| 827 | ide_hwif_t *hwif = drive->hwif; | 827 | ide_hwif_t *hwif = drive->hwif; |
| 828 | int rc; | 828 | int rc; |
| 829 | 829 | ||
| 830 | rc = ide_dma_check(drive); | 830 | /* |
| 831 | * Force DMAing for the beginning of the check. | ||
| 832 | * Some chipsets appear to do interesting | ||
| 833 | * things, if not checked and cleared. | ||
| 834 | * PARANOIA!!! | ||
| 835 | */ | ||
| 836 | hwif->dma_off_quietly(drive); | ||
| 831 | 837 | ||
| 832 | switch(rc) { | 838 | rc = ide_dma_check(drive); |
| 833 | case -1: /* DMA needs to be disabled */ | 839 | if (rc) |
| 834 | hwif->dma_off_quietly(drive); | 840 | return rc; |
| 835 | return -1; | ||
| 836 | case 0: /* DMA needs to be enabled */ | ||
| 837 | return hwif->ide_dma_on(drive); | ||
| 838 | case 1: /* DMA setting cannot be changed */ | ||
| 839 | break; | ||
| 840 | default: | ||
| 841 | BUG(); | ||
| 842 | break; | ||
| 843 | } | ||
| 844 | 841 | ||
| 845 | return rc; | 842 | return hwif->ide_dma_on(drive); |
| 846 | } | 843 | } |
| 847 | 844 | ||
| 848 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 845 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e053e00a7058..2711b5a6962d 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
| @@ -221,7 +221,6 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
| 221 | */ | 221 | */ |
| 222 | if (drive->hwif->ide_dma_on == NULL) | 222 | if (drive->hwif->ide_dma_on == NULL) |
| 223 | break; | 223 | break; |
| 224 | drive->hwif->dma_off_quietly(drive); | ||
| 225 | /* | 224 | /* |
| 226 | * TODO: respect ->using_dma setting | 225 | * TODO: respect ->using_dma setting |
| 227 | */ | 226 | */ |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 33e62d28465d..0379d1f697cf 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -833,16 +833,8 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
| 833 | 833 | ||
| 834 | drive->nice1 = 1; | 834 | drive->nice1 = 1; |
| 835 | 835 | ||
| 836 | if (hwif->ide_dma_on) { | 836 | if (hwif->ide_dma_on) |
| 837 | /* | ||
| 838 | * Force DMAing for the beginning of the check. | ||
| 839 | * Some chipsets appear to do interesting | ||
| 840 | * things, if not checked and cleared. | ||
| 841 | * PARANOIA!!! | ||
| 842 | */ | ||
| 843 | hwif->dma_off_quietly(drive); | ||
| 844 | ide_set_dma(drive); | 837 | ide_set_dma(drive); |
| 845 | } | ||
| 846 | } | 838 | } |
| 847 | } | 839 | } |
| 848 | 840 | ||
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 00ef6ec2c273..c6d4f630e18a 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -851,7 +851,6 @@ int set_using_dma(ide_drive_t *drive, int arg) | |||
| 851 | err = 0; | 851 | err = 0; |
| 852 | 852 | ||
| 853 | if (arg) { | 853 | if (arg) { |
| 854 | hwif->dma_off_quietly(drive); | ||
| 855 | if (ide_set_dma(drive)) | 854 | if (ide_set_dma(drive)) |
| 856 | err = -EIO; | 855 | err = -EIO; |
| 857 | } else | 856 | } else |
