Skip to contentSkip to conversation

ide: move drive->using_dma check to callers of ->dma_host_on method

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Nov 12, 2007 – Nov 13, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 12/13 ide: move drive->using_dma check to callers of ->dma_host_on method

---
 drivers/ide/ide-dma.c    |    2 +-
 drivers/ide/ide-iops.c   |    3 ++-
 drivers/ide/pci/cs5520.c |    3 +--
 drivers/ide/pci/sc1200.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/ide/ide-dma.c +1 -1
Index: b/drivers/ide/ide-dma.c
===================================================================
@@ -470,7 +470,7 @@ EXPORT_SYMBOL(ide_dma_off);
 
 void ide_dma_host_on(ide_drive_t *drive)
 {
-	if (drive->using_dma) {
+	if (1) {
 		ide_hwif_t *hwif	= HWIF(drive);
 		u8 unit			= (drive->select.b.unit & 0x01);
 		u8 dma_stat		= hwif->INB(hwif->dma_status);
drivers/ide/ide-iops.c +2 -1
Index: b/drivers/ide/ide-iops.c
===================================================================
@@ -791,7 +791,8 @@ int ide_config_drive_speed(ide_drive_t *
 	drive->id->dma_1word &= ~0x0F00;
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	if (speed >= XFER_SW_DMA_0 || (hwif->host_flags & IDE_HFLAG_VDMA))
+	if ((speed >= XFER_SW_DMA_0 || (hwif->host_flags & IDE_HFLAG_VDMA)) &&
+	    drive->using_dma)
 		hwif->dma_host_on(drive);
 	else if (hwif->dma_host_on)	/* check if host supports DMA */
 		ide_dma_off_quietly(drive);
drivers/ide/pci/cs5520.c +1 -2
Index: b/drivers/ide/pci/cs5520.c
===================================================================
@@ -109,8 +109,7 @@ static void cs5520_set_dma_mode(ide_driv
 
 static void cs5520_dma_host_on(ide_drive_t *drive)
 {
-	if (drive->using_dma)
-		drive->vdma = 1;
+	drive->vdma = 1;
 
 	ide_dma_host_on(drive);
 }
drivers/ide/pci/sc1200.c +1 -1
Index: b/drivers/ide/pci/sc1200.c
===================================================================
@@ -221,7 +221,7 @@ static void sc1200_set_pio_mode(ide_driv
 	if (mode != -1) {
 		printk("SC1200: %s: changing (U)DMA mode\n", drive->name);
 		ide_dma_off_quietly(drive);
-		if (ide_set_dma_mode(drive, mode) == 0)
+		if (ide_set_dma_mode(drive, mode) == 0 && drive->using_dma)
 			hwif->dma_host_on(drive);
 		return;
 	}
Acked-by on v1 12/13
#1 lore raw
Quoted 1 line · Bartlomiej Zolnierkiewicz

MBR, Sergei

drivers/ide/ide-dma.c EXPORT_SYMBOL(ide_dma_off); · line 473

Quoted 10 lines

Index: b/drivers/ide/ide-dma.c
===================================================================

drivers/ide/ide-dma.c +1 -1
@@ -470,7 +470,7 @@ EXPORT_SYMBOL(ide_dma_off);
 
 void ide_dma_host_on(ide_drive_t *drive)
 {
-	if (drive->using_dma) {
+	if (1) {

Why so?

drivers/ide/ide-dma.c EXPORT_SYMBOL(ide_dma_off); · line 476

Quoted 3 lines
drivers/ide/ide-dma.c +0 -0
 		ide_hwif_t *hwif	= HWIF(drive);
 		u8 unit			= (drive->select.b.unit & 0x01);
 		u8 dma_stat		= hwif->INB(hwif->dma_status);

WBR, Sergei

#2 lore raw
Quoted 14 lines · Sergei Shtylyov
Quoted 1 line · Bartlomiej Zolnierkiewicz

MBR, Sergei

Quoted 6 lines

Index: b/drivers/ide/ide-dma.c
===================================================================

drivers/ide/ide-dma.c +0 -0
@@ -470,7 +470,7 @@ EXPORT_SYMBOL(ide_dma_off);
 
Quoted 6 lines

drivers/ide/ide-dma.c EXPORT_SYMBOL(ide_dma_off); · line 473

Quoted 4 lines
drivers/ide/ide-dma.c +1 -1
 void ide_dma_host_on(ide_drive_t *drive)
 {
-	if (drive->using_dma) {
+	if (1) {

Why so?

Just not to move the code around (because it "vanishes" in patch #13/13).

Quoted 3 lines
Quoted 3 lines
drivers/ide/ide-dma.c +0 -0
 		ide_hwif_t *hwif	= HWIF(drive);
 		u8 unit			= (drive->select.b.unit & 0x01);
 		u8 dma_stat		= hwif->INB(hwif->dma_status);