Commit 15ce926a authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

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.

Acked-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent f37aaf9e
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -287,11 +287,7 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode)
		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)
	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;
+2 −7
Original line number Diff line number Diff line
@@ -674,11 +674,7 @@ static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int);
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)
{
}

@@ -792,6 +788,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;
@@ -802,8 +799,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,
+15 −35
Original line number Diff line number Diff line
@@ -408,23 +408,28 @@ static int dma_timer_expiry (ide_drive_t *drive)
}

/**
 *	ide_dma_host_off	-	Generic DMA kill
 *	ide_dma_host_set	-	Enable/disable DMA on a host
 *	@drive: drive to control
 *
 *	Perform the generic IDE controller DMA off operation. This
 *	works for most IDE bus mastering controllers
 *	Enable/disable DMA on an IDE controller following generic
 *	bus-mastering IDE controller behaviour.
 */

void ide_dma_host_off(ide_drive_t *drive)
void ide_dma_host_set(ide_drive_t *drive, int on)
{
	ide_hwif_t *hwif	= HWIF(drive);
	u8 unit			= (drive->select.b.unit & 0x01);
	u8 dma_stat		= hwif->INB(hwif->dma_status);

	hwif->OUTB((dma_stat & ~(1<<(5+unit))), hwif->dma_status);
	if (on)
		dma_stat |= (1 << (5 + unit));
	else
		dma_stat &= ~(1 << (5 + unit));

	hwif->OUTB(dma_stat, hwif->dma_status);
}

EXPORT_SYMBOL(ide_dma_host_off);
EXPORT_SYMBOL_GPL(ide_dma_host_set);
#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */

/**
@@ -439,7 +444,7 @@ void ide_dma_off_quietly(ide_drive_t *drive)
	drive->using_dma = 0;
	ide_toggle_bounce(drive, 0);

	drive->hwif->dma_host_off(drive);
	drive->hwif->dma_host_set(drive, 0);
}

EXPORT_SYMBOL(ide_dma_off_quietly);
@@ -460,29 +465,6 @@ void ide_dma_off(ide_drive_t *drive)

EXPORT_SYMBOL(ide_dma_off);

#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
/**
 *	ide_dma_host_on	-	Enable DMA on a host
 *	@drive: drive to enable for DMA
 *
 *	Enable DMA on an IDE controller following generic bus mastering
 *	IDE controller behaviour
 */

void ide_dma_host_on(ide_drive_t *drive)
{
	if (1) {
		ide_hwif_t *hwif	= HWIF(drive);
		u8 unit			= (drive->select.b.unit & 0x01);
		u8 dma_stat		= hwif->INB(hwif->dma_status);

		hwif->OUTB((dma_stat|(1<<(5+unit))), hwif->dma_status);
	}
}

EXPORT_SYMBOL(ide_dma_host_on);
#endif

/**
 *	ide_dma_on		-	Enable DMA on a device
 *	@drive: drive to enable DMA on
@@ -495,7 +477,7 @@ void ide_dma_on(ide_drive_t *drive)
	drive->using_dma = 1;
	ide_toggle_bounce(drive, 1);

	drive->hwif->dma_host_on(drive);
	drive->hwif->dma_host_set(drive, 1);
}

EXPORT_SYMBOL(ide_dma_on);
@@ -980,10 +962,8 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
	if (!(hwif->dma_prdtable))
		hwif->dma_prdtable	= (hwif->dma_base + 4);

	if (!hwif->dma_host_off)
		hwif->dma_host_off = &ide_dma_host_off;
	if (!hwif->dma_host_on)
		hwif->dma_host_on = &ide_dma_host_on;
	if (!hwif->dma_host_set)
		hwif->dma_host_set = &ide_dma_host_set;
	if (!hwif->dma_setup)
		hwif->dma_setup = &ide_dma_setup;
	if (!hwif->dma_exec_cmd)
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
		 * 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
+4 −4
Original line number Diff line number Diff line
@@ -742,8 +742,8 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
//		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

	/* Skip setting PIO flow-control modes on pre-EIDE drives */
@@ -801,8 +801,8 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
#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

Loading