Commit d9bb5003 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] make __ide_dma_off() generic and remove ide_hwif_t->ide_dma_off

Move ide-dma.c:__ide_dma_off() outside of #ifdef CONFIG_BLK_DEV_IDEDMA_PCI,
so it can be used for all DMA capable hosts.  Remove ide_hwif_t->ide_dma_off.
parent 22e84a6b
......@@ -341,12 +341,6 @@ static int icside_dma_off_quietly(ide_drive_t *drive)
return icside_dma_host_off(drive);
}
static int icside_dma_off(ide_drive_t *drive)
{
printk("%s: DMA disabled\n", drive->name);
return icside_dma_off_quietly(drive);
}
static int icside_dma_host_on(ide_drive_t *drive)
{
return 0;
......@@ -643,7 +637,6 @@ static int icside_dma_init(ide_hwif_t *hwif)
hwif->ide_dma_check = icside_dma_check;
hwif->ide_dma_host_off = icside_dma_host_off;
hwif->ide_dma_off_quietly = icside_dma_off_quietly;
hwif->ide_dma_off = icside_dma_off;
hwif->ide_dma_host_on = icside_dma_host_on;
hwif->ide_dma_on = icside_dma_on;
hwif->ide_dma_read = icside_dma_read;
......
......@@ -1101,7 +1101,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
if (dma) {
info->dma = 0;
if ((dma_error = HWIF(drive)->ide_dma_end(drive)))
HWIF(drive)->ide_dma_off(drive);
__ide_dma_off(drive);
}
if (cdrom_decode_status(drive, 0, &stat))
......@@ -1720,7 +1720,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
if (dma) {
if (dma_error) {
printk("ide-cd: dma error\n");
HWIF(drive)->ide_dma_off(drive);
__ide_dma_off(drive);
return DRIVER(drive)->error(drive, "dma error", stat);
}
......@@ -1847,7 +1847,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
info->dma = 0;
if ((dma_error = HWIF(drive)->ide_dma_end(drive))) {
printk("ide-cd: write dma error\n");
HWIF(drive)->ide_dma_off(drive);
__ide_dma_off(drive);
}
}
......
......@@ -414,7 +414,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
if ((id->capability & 1) && hwif->autodma) {
/* Consult the list of known "bad" drives */
if (__ide_dma_bad_drive(drive))
return hwif->ide_dma_off(drive);
return __ide_dma_off(drive);
/*
* Enable DMA on any drive that has
......@@ -520,13 +520,14 @@ int __ide_dma_off_quietly (ide_drive_t *drive)
}
EXPORT_SYMBOL(__ide_dma_off_quietly);
#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
/**
* __ide_dma_host_off - Generic DMA kill
* @drive: drive to control
* __ide_dma_off - disable DMA on a device
* @drive: drive to disable DMA on
*
* Turn off the current DMA on this IDE controller. Inform the
* user that DMA has been disabled.
* Disable IDE DMA for a device on this IDE controller.
* Inform the user that DMA has been disabled.
*/
int __ide_dma_off (ide_drive_t *drive)
......@@ -537,6 +538,7 @@ int __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
......@@ -1049,8 +1051,6 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
if (!(hwif->dma_prdtable))
hwif->dma_prdtable = (hwif->dma_base + 4);
if (!hwif->ide_dma_off)
hwif->ide_dma_off = &__ide_dma_off;
if (!hwif->ide_dma_off_quietly)
hwif->ide_dma_off_quietly = &__ide_dma_off_quietly;
if (!hwif->ide_dma_host_off)
......
......@@ -830,7 +830,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
if (test_and_clear_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
printk(KERN_ERR "ide-floppy: The floppy wants to issue "
"more interrupts in DMA mode\n");
(void) HWIF(drive)->ide_dma_off(drive);
(void)__ide_dma_off(drive);
return ide_do_reset(drive);
}
......@@ -1045,7 +1045,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
bcount.all = min(pc->request_transfer, 63 * 1024);
if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) {
(void) HWIF(drive)->ide_dma_off(drive);
(void)__ide_dma_off(drive);
}
feature.all = 0;
......
......@@ -1133,7 +1133,7 @@ void check_dma_crc (ide_drive_t *drive)
if (drive->current_speed >= XFER_SW_DMA_0)
(void) HWIF(drive)->ide_dma_on(drive);
} else {
(void) HWIF(drive)->ide_dma_off(drive);
(void)__ide_dma_off(drive);
}
}
......
......@@ -2198,7 +2198,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
printk(KERN_ERR "ide-tape: The tape wants to issue more "
"interrupts in DMA mode\n");
printk(KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
(void) HWIF(drive)->ide_dma_off(drive);
(void)__ide_dma_off(drive);
return ide_do_reset(drive);
}
/* Get the number of bytes to transfer on this interrupt. */
......@@ -2411,7 +2411,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) {
printk(KERN_WARNING "ide-tape: DMA disabled, "
"reverting to PIO\n");
(void) HWIF(drive)->ide_dma_off(drive);
(void)__ide_dma_off(drive);
}
if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
if (test_bit(PC_WRITING, &pc->flags))
......
......@@ -839,7 +839,6 @@ void ide_unregister (unsigned int index)
hwif->ide_dma_end = old_hwif.ide_dma_end;
hwif->ide_dma_check = old_hwif.ide_dma_check;
hwif->ide_dma_on = old_hwif.ide_dma_on;
hwif->ide_dma_off = old_hwif.ide_dma_off;
hwif->ide_dma_off_quietly = old_hwif.ide_dma_off_quietly;
hwif->ide_dma_test_irq = old_hwif.ide_dma_test_irq;
hwif->ide_dma_host_on = old_hwif.ide_dma_host_on;
......@@ -1329,7 +1328,8 @@ static int set_using_dma (ide_drive_t *drive, int arg)
if (HWIF(drive)->ide_dma_check(drive)) return -EIO;
if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
} else {
if (HWIF(drive)->ide_dma_off(drive)) return -EIO;
if (__ide_dma_off(drive))
return -EIO;
}
return 0;
}
......
......@@ -302,14 +302,6 @@ sgiioc4_ide_dma_on(ide_drive_t * drive)
return HWIF(drive)->ide_dma_host_on(drive);
}
static int
sgiioc4_ide_dma_off(ide_drive_t * drive)
{
printk(KERN_INFO "%s: DMA disabled\n", drive->name);
return HWIF(drive)->ide_dma_off_quietly(drive);
}
static int
sgiioc4_ide_dma_off_quietly(ide_drive_t * drive)
{
......@@ -644,7 +636,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
hwif->ide_dma_end = &sgiioc4_ide_dma_end;
hwif->ide_dma_check = &sgiioc4_ide_dma_check;
hwif->ide_dma_on = &sgiioc4_ide_dma_on;
hwif->ide_dma_off = &sgiioc4_ide_dma_off;
hwif->ide_dma_off_quietly = &sgiioc4_ide_dma_off_quietly;
hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq;
hwif->ide_dma_host_on = &sgiioc4_ide_dma_host_on;
......
......@@ -272,22 +272,6 @@ static int sl82c105_ide_dma_on (ide_drive_t *drive)
return __ide_dma_on(drive);
}
static int sl82c105_ide_dma_off (ide_drive_t *drive)
{
u8 speed = XFER_PIO_0;
int rc;
DBG(("sl82c105_ide_dma_off(drive:%s)\n", drive->name));
rc = __ide_dma_off(drive);
if (drive->pio_speed)
speed = drive->pio_speed - XFER_PIO_0;
config_for_pio(drive, speed, 0, 1);
drive->current_speed = drive->pio_speed;
return rc;
}
static int sl82c105_ide_dma_off_quietly (ide_drive_t *drive)
{
u8 speed = XFER_PIO_0;
......@@ -485,7 +469,6 @@ static void __init init_hwif_sl82c105(ide_hwif_t *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA
hwif->ide_dma_check = &sl82c105_check_drive;
hwif->ide_dma_on = &sl82c105_ide_dma_on;
hwif->ide_dma_off = &sl82c105_ide_dma_off;
hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly;
hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq;
hwif->ide_dma_begin = &sl82c105_ide_dma_begin;
......
......@@ -2153,7 +2153,6 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
pmif->dma_table_cpu, pmif->dma_table_dma);
return;
}
hwif->ide_dma_off = &__ide_dma_off;
hwif->ide_dma_off_quietly = &__ide_dma_off_quietly;
hwif->ide_dma_on = &__ide_dma_on;
hwif->ide_dma_check = &pmac_ide_dma_check;
......
......@@ -790,7 +790,6 @@ typedef struct ide_dma_ops_s {
int (*ide_dma_end)(ide_drive_t *drive);
int (*ide_dma_check)(ide_drive_t *drive);
int (*ide_dma_on)(ide_drive_t *drive);
int (*ide_dma_off)(ide_drive_t *drive);
int (*ide_dma_off_quietly)(ide_drive_t *drive);
int (*ide_dma_test_irq)(ide_drive_t *drive);
int (*ide_dma_host_on)(ide_drive_t *drive);
......@@ -926,7 +925,6 @@ typedef struct hwif_s {
int (*ide_dma_end)(ide_drive_t *drive);
int (*ide_dma_check)(ide_drive_t *drive);
int (*ide_dma_on)(ide_drive_t *drive);
int (*ide_dma_off)(ide_drive_t *drive);
int (*ide_dma_off_quietly)(ide_drive_t *drive);
int (*ide_dma_test_irq)(ide_drive_t *drive);
int (*ide_dma_host_on)(ide_drive_t *drive);
......@@ -1594,6 +1592,7 @@ extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_de
#ifdef CONFIG_BLK_DEV_IDEDMA
int __ide_dma_bad_drive(ide_drive_t *);
int __ide_dma_good_drive(ide_drive_t *);
int __ide_dma_off(ide_drive_t *);
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
extern int ide_build_sglist(ide_drive_t *, struct request *);
......@@ -1607,7 +1606,6 @@ extern int ide_start_dma(ide_hwif_t *, ide_drive_t *, int);
extern int __ide_dma_host_off(ide_drive_t *);
extern int __ide_dma_off_quietly(ide_drive_t *);
extern int __ide_dma_off(ide_drive_t *);
extern int __ide_dma_host_on(ide_drive_t *);
extern int __ide_dma_on(ide_drive_t *);
extern int __ide_dma_check(ide_drive_t *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment