Skip to contentSkip to conversation

ide: merge ->dma_host_{on,off} methods into ->dma_host_set method

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 2 messages Nov 12, 2007 – Nov 14, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 13/13 ide: merge ->dma_host_{on,off} methods into ->dma_host_set method

Merge ->dma_host_{on,off} methods into ->dma_host_set method which takes 'int on' argument.

There should be no functionality changes caused by this patch.

---
 drivers/ide/arm/icside.c      |    9 +------
 drivers/ide/cris/ide-cris.c   |    9 +------
 drivers/ide/ide-dma.c         |   50 ++++++++++++------------------------------
 drivers/ide/ide-io.c          |    2 -
 drivers/ide/ide-iops.c        |    8 +++---
 drivers/ide/ide-probe.c       |    2 -
 drivers/ide/ide.c             |    5 +---
 drivers/ide/mips/au1xxx-ide.c |    9 +------
 drivers/ide/pci/cs5520.c      |   17 +++-----------
 drivers/ide/pci/sc1200.c      |    2 -
 drivers/ide/pci/sgiioc4.c     |   12 +++-------
 drivers/ide/ppc/pmac.c        |    9 +------
 include/linux/ide.h           |    6 +----
 13 files changed, 42 insertions(+), 98 deletions(-)
drivers/ide/arm/icside.c +2 -7
Index: b/drivers/ide/arm/icside.c
===================================================================
@@ -287,11 +287,7 @@ static void icside_set_dma_mode(ide_driv
 		ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data);
 }
 
-static void icside_dma_host_off(ide_drive_t *drive)
-{
-}
-
-static void icside_dma_host_on(ide_drive_t *drive)
+static void icside_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
@@ -410,8 +406,7 @@ static void icside_dma_init(ide_hwif_t *
 	hwif->dmatable_dma	= 0;
 	hwif->set_dma_mode	= icside_set_dma_mode;
 
-	hwif->dma_host_off	= icside_dma_host_off;
-	hwif->dma_host_on	= icside_dma_host_on;
+	hwif->dma_host_set	= icside_dma_host_set;
 	hwif->dma_setup		= icside_dma_setup;
 	hwif->dma_exec_cmd	= icside_dma_exec_cmd;
 	hwif->dma_start		= icside_dma_start;
drivers/ide/cris/ide-cris.c +2 -7
Index: b/drivers/ide/cris/ide-cris.c
===================================================================
@@ -674,11 +674,7 @@ static void cris_ide_output_data (ide_dr
 static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
 static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
 
-static void cris_dma_host_off(ide_drive_t *drive)
-{
-}
-
-static void cris_dma_host_on(ide_drive_t *drive)
+static void cris_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
@@ -791,6 +787,7 @@ init_e100_ide (void)
 		hwif->ata_output_data = &cris_ide_output_data;
 		hwif->atapi_input_bytes = &cris_atapi_input_bytes;
 		hwif->atapi_output_bytes = &cris_atapi_output_bytes;
+		hwif->dma_host_set = &cris_dma_host_set;
 		hwif->ide_dma_end = &cris_dma_end;
 		hwif->dma_setup = &cris_dma_setup;
 		hwif->dma_exec_cmd = &cris_dma_exec_cmd;
@@ -801,8 +798,6 @@ init_e100_ide (void)
 		hwif->OUTBSYNC = &cris_ide_outbsync;
 		hwif->INB = &cris_ide_inb;
 		hwif->INW = &cris_ide_inw;
-		hwif->dma_host_off = &cris_dma_host_off;
-		hwif->dma_host_on = &cris_dma_host_on;
 		hwif->cbl = ATA_CBL_PATA40;
 		hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
 		hwif->pio_mask = ATA_PIO4,
drivers/ide/ide-dma.c +15 -35

91 lines not on this page · raw message

drivers/ide/ide-io.c +1 -1
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -219,7 +219,7 @@ static ide_startstop_t ide_start_power_s
 		 * we could be smarter and check for current xfer_speed
 		 * in struct drive etc...
 		 */
-		if (drive->hwif->dma_host_on == NULL)
+		if (drive->hwif->dma_host_set == NULL)
 			break;
 		/*
 		 * TODO: respect ->using_dma setting
drivers/ide/ide-iops.c +4 -4
Index: b/drivers/ide/ide-iops.c
===================================================================
@@ -739,8 +739,8 @@ int ide_config_drive_speed(ide_drive_t *
 //		msleep(50);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-	if (hwif->dma_host_on)	/* check if host supports DMA */
-		hwif->dma_host_off(drive);
+	if (hwif->dma_host_set)	/* check if host supports DMA */
+		hwif->dma_host_set(drive, 0);
 #endif
 
 	/*
@@ -793,8 +793,8 @@ int ide_config_drive_speed(ide_drive_t *
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	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 */
+		hwif->dma_host_set(drive, 1);
+	else if (hwif->dma_host_set)	/* check if host supports DMA */
 		ide_dma_off_quietly(drive);
 #endif
 
drivers/ide/ide-probe.c +1 -1
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -840,7 +840,7 @@ static void probe_hwif(ide_hwif_t *hwif)
 
 			drive->nice1 = 1;
 
-			if (hwif->dma_host_on)
+			if (hwif->dma_host_set)
 				ide_set_dma(drive);
 		}
 	}
drivers/ide/ide.c +2 -3
Index: b/drivers/ide/ide.c
===================================================================
@@ -433,14 +433,13 @@ static void ide_hwif_restore(ide_hwif_t 
 	hwif->atapi_input_bytes		= tmp_hwif->atapi_input_bytes;
 	hwif->atapi_output_bytes	= tmp_hwif->atapi_output_bytes;
 
+	hwif->dma_host_set		= tmp_hwif->dma_host_set;
 	hwif->dma_setup			= tmp_hwif->dma_setup;
 	hwif->dma_exec_cmd		= tmp_hwif->dma_exec_cmd;
 	hwif->dma_start			= tmp_hwif->dma_start;
 	hwif->ide_dma_end		= tmp_hwif->ide_dma_end;
 	hwif->ide_dma_test_irq		= tmp_hwif->ide_dma_test_irq;
 	hwif->ide_dma_clear_irq		= tmp_hwif->ide_dma_clear_irq;
-	hwif->dma_host_on		= tmp_hwif->dma_host_on;
-	hwif->dma_host_off		= tmp_hwif->dma_host_off;
 	hwif->dma_lost_irq		= tmp_hwif->dma_lost_irq;
 	hwif->dma_timeout		= tmp_hwif->dma_timeout;
 
@@ -828,7 +827,7 @@ int set_using_dma(ide_drive_t *drive, in
 	if (!drive->id || !(drive->id->capability & 1))
 		goto out;
 
-	if (hwif->dma_host_on == NULL)
+	if (hwif->dma_host_set == NULL)
 		goto out;
 
 	err = -EBUSY;
drivers/ide/mips/au1xxx-ide.c +2 -7
Index: b/drivers/ide/mips/au1xxx-ide.c
===================================================================
@@ -395,11 +395,7 @@ static int auide_dma_test_irq(ide_drive_
 	return 0;
 }
 
-static void auide_dma_host_on(ide_drive_t *drive)
-{
-}
-
-static void auide_dma_host_off(ide_drive_t *drive)
+static void auide_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
@@ -674,13 +670,12 @@ static int au_ide_probe(struct device *d
 
 	hwif->mdma_filter		= &auide_mdma_filter;
 
+	hwif->dma_host_set		= &auide_dma_host_set;
 	hwif->dma_exec_cmd              = &auide_dma_exec_cmd;
 	hwif->dma_start                 = &auide_dma_start;
 	hwif->ide_dma_end               = &auide_dma_end;
 	hwif->dma_setup                 = &auide_dma_setup;
 	hwif->ide_dma_test_irq          = &auide_dma_test_irq;
-	hwif->dma_host_off		= &auide_dma_host_off;
-	hwif->dma_host_on		= &auide_dma_host_on;
 	hwif->dma_lost_irq		= &auide_dma_lost_irq;
 #else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
 	hwif->channel                   = 0;
drivers/ide/pci/cs5520.c +4 -13
Index: b/drivers/ide/pci/cs5520.c
===================================================================
@@ -107,18 +107,10 @@ static void cs5520_set_dma_mode(ide_driv
  *	ATAPI is harder so disable it for now using IDE_HFLAG_NO_ATAPI_DMA
  */
 
-static void cs5520_dma_host_on(ide_drive_t *drive)
+static void cs5520_dma_host_set(ide_drive_t *drive, int on)
 {
-	drive->vdma = 1;
-
-	ide_dma_host_on(drive);
-}
-
-static void cs5520_dma_host_off(ide_drive_t *drive)
-{
-	drive->vdma = 0;
-
-	ide_dma_host_off(drive);
+	drive->vdma = on;
+	ide_dma_host_set(drive, on);
 }
 
 static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
@@ -129,8 +121,7 @@ static void __devinit init_hwif_cs5520(i
 	if (hwif->dma_base == 0)
 		return;
 
-	hwif->dma_host_on  = &cs5520_dma_host_on;
-	hwif->dma_host_off = &cs5520_dma_host_off;
+	hwif->dma_host_set = &cs5520_dma_host_set;
 }
 
 #define DECLARE_CS_DEV(name_str)				\
drivers/ide/pci/sc1200.c +1 -1
Index: b/drivers/ide/pci/sc1200.c
===================================================================
@@ -222,7 +222,7 @@ static void sc1200_set_pio_mode(ide_driv
 		printk("SC1200: %s: changing (U)DMA mode\n", drive->name);
 		ide_dma_off_quietly(drive);
 		if (ide_set_dma_mode(drive, mode) == 0 && drive->using_dma)
-			hwif->dma_host_on(drive);
+			hwif->dma_host_set(drive, 1);
 		return;
 	}
 
drivers/ide/pci/sgiioc4.c +4 -8
Index: b/drivers/ide/pci/sgiioc4.c
===================================================================
@@ -288,13 +288,10 @@ sgiioc4_ide_dma_test_irq(ide_drive_t * d
 	return sgiioc4_checkirq(HWIF(drive));
 }
 
-static void sgiioc4_dma_host_on(ide_drive_t * drive)
+static void sgiioc4_dma_host_set(ide_drive_t *drive, int on)
 {
-}
-
-static void sgiioc4_dma_host_off(ide_drive_t * drive)
-{
-	sgiioc4_clearirq(drive);
+	if (!on)
+		sgiioc4_clearirq(drive);
 }
 
 static void
@@ -578,12 +575,11 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
 
 	hwif->mwdma_mask = ATA_MWDMA2_ONLY;
 
+	hwif->dma_host_set = &sgiioc4_dma_host_set;
 	hwif->dma_setup = &sgiioc4_ide_dma_setup;
 	hwif->dma_start = &sgiioc4_ide_dma_start;
 	hwif->ide_dma_end = &sgiioc4_ide_dma_end;
 	hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq;
-	hwif->dma_host_on = &sgiioc4_dma_host_on;
-	hwif->dma_host_off = &sgiioc4_dma_host_off;
 	hwif->dma_lost_irq = &sgiioc4_dma_lost_irq;
 	hwif->dma_timeout = &ide_dma_timeout;
 }
drivers/ide/ppc/pmac.c +2 -7
Index: b/drivers/ide/ppc/pmac.c
===================================================================
@@ -1698,11 +1698,7 @@ pmac_ide_dma_test_irq (ide_drive_t *driv
 	return 1;
 }
 
-static void pmac_ide_dma_host_off(ide_drive_t *drive)
-{
-}
-
-static void pmac_ide_dma_host_on(ide_drive_t *drive)
+static void pmac_ide_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
@@ -1748,13 +1744,12 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif
 		return;
 	}
 
+	hwif->dma_host_set = &pmac_ide_dma_host_set;
 	hwif->dma_setup = &pmac_ide_dma_setup;
 	hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd;
 	hwif->dma_start = &pmac_ide_dma_start;
 	hwif->ide_dma_end = &pmac_ide_dma_end;
 	hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq;
-	hwif->dma_host_off = &pmac_ide_dma_host_off;
-	hwif->dma_host_on = &pmac_ide_dma_host_on;
 	hwif->dma_timeout = &ide_dma_timeout;
 	hwif->dma_lost_irq = &pmac_ide_dma_lost_irq;
 
include/linux/ide.h +2 -4
Index: b/include/linux/ide.h
===================================================================
@@ -542,14 +542,13 @@ typedef struct hwif_s {
 	void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
 	void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
 
+	void (*dma_host_set)(ide_drive_t *, int);
 	int (*dma_setup)(ide_drive_t *);
 	void (*dma_exec_cmd)(ide_drive_t *, u8);
 	void (*dma_start)(ide_drive_t *);
 	int (*ide_dma_end)(ide_drive_t *drive);
 	int (*ide_dma_test_irq)(ide_drive_t *drive);
 	void (*ide_dma_clear_irq)(ide_drive_t *drive);
-	void (*dma_host_on)(ide_drive_t *drive);
-	void (*dma_host_off)(ide_drive_t *drive);
 	void (*dma_lost_irq)(ide_drive_t *drive);
 	void (*dma_timeout)(ide_drive_t *drive);
 
@@ -1160,8 +1159,7 @@ extern void ide_destroy_dmatable(ide_dri
 extern int ide_release_dma(ide_hwif_t *);
 extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int);
 
-void ide_dma_host_off(ide_drive_t *);
-void ide_dma_host_on(ide_drive_t *);
+void ide_dma_host_set(ide_drive_t *, int);
 extern int ide_dma_setup(ide_drive_t *);
 extern void ide_dma_start(ide_drive_t *);
 extern int __ide_dma_end(ide_drive_t *);