]> err.no Git - linux-2.6/commitdiff
ide: merge ->dma_host_{on,off} methods into ->dma_host_set method
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Jan 2008 19:13:03 +0000 (20:13 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Jan 2008 19:13:03 +0000 (20:13 +0100)
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: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
14 files changed:
drivers/ide/arm/icside.c
drivers/ide/cris/ide-cris.c
drivers/ide/ide-dma.c
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide-probe.c
drivers/ide/ide.c
drivers/ide/mips/au1xxx-ide.c
drivers/ide/pci/cs5520.c
drivers/ide/pci/sc1200.c
drivers/ide/pci/sgiioc4.c
drivers/ide/pci/trm290.c
drivers/ide/ppc/pmac.c
include/linux/ide.h

index 3a8402bb5dc3066e05974092eb97a7a9fb4e8ede..8a5c7205b77c7a4176406449c90272fc4fd9f256 100644 (file)
@@ -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;
index b0cd0326cf57aa10883f7fc83ed19e485a1b3a99..dcebc0299f5eeede3208149f31c76028388c08dc 100644 (file)
@@ -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,
index 780911e0537e516c20f1c78c19f63d96e47667f7..c9648b1ef22071bc811e7b1f15c5587175704a31 100644 (file)
@@ -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)
index b5a7d2578ab8419cef8d2a0082375c89a7fcc4d5..e37b09c81e3a5d6e1b55bfa854f33c6a75e3a03b 100644 (file)
@@ -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
index e30f67e09b9c28c6b2f1d1d93c6e4f6cfe4bef2e..595a5cef41a2b9f58dd3e2ea32f7c09ca64a2cfe 100644 (file)
@@ -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
 
index b363a96607d1d1f448cd6150e9ac5912e15cfd52..fa95e79b950533be5075d2cdad83471c0aba9409 100644 (file)
@@ -833,7 +833,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);
                }
        }
index 095ff34870da308df3812b0b12a8c93b2acc6a68..7819fbd4d5fd317d19b602bf3ee66a9588ed6d8b 100644 (file)
@@ -433,14 +433,13 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
        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;
 
@@ -834,7 +833,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
        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;
index 4dfdca4ccbde90f8fbc892f772b1fe9fa83811c3..27abff6f6ba2deb62c209b6d1c23df3160e513e6 100644 (file)
@@ -395,11 +395,7 @@ static int auide_dma_test_irq(ide_drive_t *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 *dev)
 
        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;
index 2bd52af83d37d9c8110ef72bd672cd111f1753f1..6ec00b8d7ec1b1e10f51a7e023b4a9ed6ffed1b4 100644 (file)
@@ -107,18 +107,10 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
  *     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(ide_hwif_t *hwif)
        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)                               \
index 9303dfee7780a4507f1edc9fd94db0669d7e71e1..32fdf53379f5a5bf6cd817628c6543a4dba71182 100644 (file)
@@ -222,7 +222,7 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio)
                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;
        }
 
index 8c4e94bd4449251c333ee433cba32af32c8ae556..9fb35c528d54f7bc15b112c8d34fcf2249793aa7 100644 (file)
@@ -288,13 +288,10 @@ sgiioc4_ide_dma_test_irq(ide_drive_t * drive)
        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;
 }
index 0151d7fdfb8a7dade521aadbd3e0250ed21e49c9..04cd893e1ab053e8621aa486fdfe2087725ace49 100644 (file)
@@ -241,11 +241,7 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
        return (status == 0x00ff);
 }
 
-static void trm290_dma_host_on(ide_drive_t *drive)
-{
-}
-
-static void trm290_dma_host_off(ide_drive_t *drive)
+static void trm290_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
@@ -289,8 +285,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 
        ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
 
-       hwif->dma_host_off      = &trm290_dma_host_off;
-       hwif->dma_host_on       = &trm290_dma_host_on;
+       hwif->dma_host_set      = &trm290_dma_host_set;
        hwif->dma_setup         = &trm290_dma_setup;
        hwif->dma_exec_cmd      = &trm290_dma_exec_cmd;
        hwif->dma_start         = &trm290_dma_start;
index ca99b69cfac7cf63628c4efa88ea9ea8c2e24035..6a4b0d4798971736aa0b450296183e88ed7fe4a0 100644 (file)
@@ -1698,11 +1698,7 @@ pmac_ide_dma_test_irq (ide_drive_t *drive)
        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, ide_hwif_t *hwif)
                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;
 
index 140864d63aed1cb3208db7bd541d1d07cabcbe7e..ffb76d0d0814904248cb838b454f8febcdc00bb9 100644 (file)
@@ -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_drive_t *);
 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 *);