pata_ali: fix checking of DMA state
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Tue, 12 Oct 2021 06:27:46 +0000 (08:27 +0200)
committerDamien Le Moal <damien.lemoal@wdc.com>
Tue, 12 Oct 2021 08:46:52 +0000 (17:46 +0900)
Checking if DMA is enabled should be done via the
ata_dma_enabled helper function, since the init state
0xff indicates disabled.
Change based on code review, not tested due to lack of hardware.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
drivers/ata/pata_ali.c

index 557ecf4..b7ff63e 100644 (file)
@@ -215,7 +215,7 @@ static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev)
                struct ata_timing p;
                ata_timing_compute(pair, pair->pio_mode, &p, T, 1);
                ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT);
-               if (pair->dma_mode) {
+               if (ata_dma_enabled(pair)) {
                        ata_timing_compute(pair, pair->dma_mode, &p, T, 1);
                        ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT);
                }
@@ -264,7 +264,7 @@ static void ali_set_dmamode(struct ata_port *ap, struct ata_device *adev)
                        struct ata_timing p;
                        ata_timing_compute(pair, pair->pio_mode, &p, T, 1);
                        ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT);
-                       if (pair->dma_mode) {
+                       if (ata_dma_enabled(pair)) {
                                ata_timing_compute(pair, pair->dma_mode, &p, T, 1);
                                ata_timing_merge(&p, &t, &t, ATA_TIMING_SETUP|ATA_TIMING_8BIT);
                        }