]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide: add ->dma_clear method and remove ->dma_timeout one
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 31 Mar 2009 18:15:19 +0000 (20:15 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 31 Mar 2009 18:15:19 +0000 (20:15 +0200)
All custom ->dma_timeout implementations call the generic one thus it is
possible to have only an optional method for resetting DMA engine instead:

* Add ->dma_clear method and convert hpt366, pdc202xx_old and sl82c105
  host drivers to use it.

* Always use ide_dma_timeout() in ide_dma_timeout_retry() and remove
 ->dma_timeout method.

* Make ide_dma_timeout() static.

There should be no functional changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
21 files changed:
drivers/ide/alim15x3.c
drivers/ide/au1xxx-ide.c
drivers/ide/cmd64x.c
drivers/ide/cs5536.c
drivers/ide/hpt366.c
drivers/ide/icside.c
drivers/ide/ide-dma-sff.c
drivers/ide/ide-dma.c
drivers/ide/it821x.c
drivers/ide/ns87415.c
drivers/ide/pdc202xx_old.c
drivers/ide/pmac.c
drivers/ide/sc1200.c
drivers/ide/scc_pata.c
drivers/ide/sgiioc4.c
drivers/ide/siimage.c
drivers/ide/sl82c105.c
drivers/ide/tc86c001.c
drivers/ide/trm290.c
drivers/ide/tx4939ide.c
include/linux/ide.h

index d516168464fcea89cf2256cf433a08ad6f619c77..d3faf0b97f42352b97f2e03b5d6e33f5a1e7799f 100644 (file)
@@ -509,7 +509,6 @@ static const struct ide_dma_ops ali_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index d3a9d6c15328de9b11f545160624a67e914d8401..0c08c5e01f2aadd8030cb86f4fa5f55a0aafa9f5 100644 (file)
@@ -353,7 +353,6 @@ static const struct ide_dma_ops au1xxx_dma_ops = {
        .dma_end                = auide_dma_end,
        .dma_test_irq           = auide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
-       .dma_timeout            = ide_dma_timeout,
 };
 
 static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
index bf0e3f4708242320b75a7dc705be76ef6174b13b..f0a49d2ff711fb4545864382007850ec6eb4bee1 100644 (file)
@@ -384,7 +384,6 @@ static const struct ide_dma_ops cmd64x_dma_ops = {
        .dma_test_irq           = cmd64x_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
@@ -396,7 +395,6 @@ static const struct ide_dma_ops cmd646_rev1_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
@@ -408,7 +406,6 @@ static const struct ide_dma_ops cmd648_dma_ops = {
        .dma_test_irq           = cmd648_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index d5dcf4899607a2fffc8d73af02f9113b29a6460d..353a35bbba636dcd1d3a22e1dd275efc7894319e 100644 (file)
@@ -236,7 +236,6 @@ static const struct ide_dma_ops cs5536_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
 };
 
 static const struct ide_port_info cs5536_info = {
index dbaf184ed9c5a47f74be619ebabb612c344379d5..a0eb87f59134141340181afe21c12d615d0a4484 100644 (file)
@@ -835,12 +835,6 @@ static int hpt370_dma_end(ide_drive_t *drive)
        return ide_dma_end(drive);
 }
 
-static void hpt370_dma_timeout(ide_drive_t *drive)
-{
-       hpt370_irq_timeout(drive);
-       ide_dma_timeout(drive);
-}
-
 /* returns 1 if DMA IRQ issued, 0 otherwise */
 static int hpt374_dma_test_irq(ide_drive_t *drive)
 {
@@ -1423,7 +1417,6 @@ static const struct ide_dma_ops hpt37x_dma_ops = {
        .dma_test_irq           = hpt374_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
@@ -1435,7 +1428,7 @@ static const struct ide_dma_ops hpt370_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = hpt370_dma_timeout,
+       .dma_clear              = hpt370_irq_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
@@ -1447,7 +1440,6 @@ static const struct ide_dma_ops hpt36x_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = hpt366_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index 51ce404fe53234b976cf851dd0b482c5200302b9..f069f122ee6e8cdec57c03b2f185a82b51b27e9e 100644 (file)
@@ -377,7 +377,6 @@ static const struct ide_dma_ops icside_v6_dma_ops = {
        .dma_start              = icside_dma_start,
        .dma_end                = icside_dma_end,
        .dma_test_irq           = icside_dma_test_irq,
-       .dma_timeout            = ide_dma_timeout,
        .dma_lost_irq           = ide_dma_lost_irq,
 };
 #else
index 75a9ea2e4c822e6f14988dbe5f296b85327893df..7836d7e03ffff98f1fbf5a2492fc10d184110c95 100644 (file)
@@ -338,9 +338,8 @@ const struct ide_dma_ops sff_dma_ops = {
        .dma_start              = ide_dma_start,
        .dma_end                = ide_dma_end,
        .dma_test_irq           = ide_dma_test_irq,
-       .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_lost_irq           = ide_dma_lost_irq,
+       .dma_timer_expiry       = ide_dma_sff_timer_expiry,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 EXPORT_SYMBOL_GPL(sff_dma_ops);
index 3dbf80c15491573cf7188d8597ea2e4217f9d416..dc5d9bc4ced0970d4b2f411e6fa0b881f0d2a640 100644 (file)
@@ -460,7 +460,7 @@ void ide_dma_lost_irq(ide_drive_t *drive)
 }
 EXPORT_SYMBOL_GPL(ide_dma_lost_irq);
 
-void ide_dma_timeout(ide_drive_t *drive)
+static void ide_dma_timeout(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
 
@@ -473,7 +473,6 @@ void ide_dma_timeout(ide_drive_t *drive)
 
        hwif->dma_ops->dma_end(drive);
 }
-EXPORT_SYMBOL_GPL(ide_dma_timeout);
 
 /*
  * un-busy the port etc, and clear any pending DMA status. we want to
@@ -483,6 +482,7 @@ EXPORT_SYMBOL_GPL(ide_dma_timeout);
 ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
 {
        ide_hwif_t *hwif = drive->hwif;
+       const struct ide_dma_ops *dma_ops = hwif->dma_ops;
        struct request *rq;
        ide_startstop_t ret = ide_stopped;
 
@@ -492,12 +492,14 @@ ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
 
        if (error < 0) {
                printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
-               (void)hwif->dma_ops->dma_end(drive);
+               (void)dma_ops->dma_end(drive);
                ret = ide_error(drive, "dma timeout error",
                                hwif->tp_ops->read_status(hwif));
        } else {
                printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
-               hwif->dma_ops->dma_timeout(drive);
+               if (dma_ops->dma_clear)
+                       dma_ops->dma_clear(drive);
+               ide_dma_timeout(drive);
        }
 
        /*
index 0d4ac65cf9494fe1a8bb0e0a231ef0229c8fb599..51aa745246dcb9551af49161014f533bd4d4e43c 100644 (file)
@@ -511,9 +511,8 @@ static struct ide_dma_ops it821x_pass_through_dma_ops = {
        .dma_start              = it821x_dma_start,
        .dma_end                = it821x_dma_end,
        .dma_test_irq           = ide_dma_test_irq,
-       .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_lost_irq           = ide_dma_lost_irq,
+       .dma_timer_expiry       = ide_dma_sff_timer_expiry,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index 7b65fe5bf4490c8edd3839859c66e07397bc6cb1..9039a373020ff90c064d86a3ab5c11d6add2f47e 100644 (file)
@@ -306,7 +306,6 @@ static const struct ide_dma_ops ns87415_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = superio_dma_sff_read_status,
 };
 
index f7536d1943f7ddd2001f73fd8f0dafe431290899..248a54bd2386f346e155c19a74f1c635215170a3 100644 (file)
@@ -258,12 +258,6 @@ static void pdc202xx_dma_lost_irq(ide_drive_t *drive)
        ide_dma_lost_irq(drive);
 }
 
-static void pdc202xx_dma_timeout(ide_drive_t *drive)
-{
-       pdc202xx_reset(drive);
-       ide_dma_timeout(drive);
-}
-
 static int init_chipset_pdc202xx(struct pci_dev *dev)
 {
        unsigned long dmabase = pci_resource_start(dev, 4);
@@ -336,7 +330,7 @@ static const struct ide_dma_ops pdc20246_dma_ops = {
        .dma_test_irq           = pdc202xx_dma_test_irq,
        .dma_lost_irq           = pdc202xx_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = pdc202xx_dma_timeout,
+       .dma_clear              = pdc202xx_reset,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
@@ -348,7 +342,7 @@ static const struct ide_dma_ops pdc2026x_dma_ops = {
        .dma_test_irq           = pdc202xx_dma_test_irq,
        .dma_lost_irq           = pdc202xx_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = pdc202xx_dma_timeout,
+       .dma_clear              = pdc202xx_reset,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index 2bfcfedaa0762399278b36aee7d27fa5eaebc7b1..d15cc46a66e33304b4e6dbdf08adb6586f0b18ab 100644 (file)
@@ -1650,7 +1650,6 @@ static const struct ide_dma_ops pmac_dma_ops = {
        .dma_start              = pmac_ide_dma_start,
        .dma_end                = pmac_ide_dma_end,
        .dma_test_irq           = pmac_ide_dma_test_irq,
-       .dma_timeout            = ide_dma_timeout,
        .dma_lost_irq           = pmac_ide_dma_lost_irq,
 };
 
index 1c3a82914999fa7aba1c533c3571736551cd3c57..371549d18a01be3cd48a41a89e37605f80c3586b 100644 (file)
@@ -291,7 +291,6 @@ static const struct ide_dma_ops sc1200_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index 0cc137cfe76d57f60577de9a8043ea29cb475d31..64534d150b0c720ee8fc433d6d8497aa9f0d7726 100644 (file)
@@ -872,7 +872,6 @@ static const struct ide_dma_ops scc_dma_ops = {
        .dma_end                = scc_dma_end,
        .dma_test_irq           = scc_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
-       .dma_timeout            = ide_dma_timeout,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
        .dma_sff_read_status    = scc_dma_sff_read_status,
 };
index b12de8346c738130cc2f4314344f64f65408c153..44df0c750bab2cd895823ce2dbe91f5f7191d53a 100644 (file)
@@ -533,7 +533,6 @@ static const struct ide_dma_ops sgiioc4_dma_ops = {
        .dma_end                = sgiioc4_dma_end,
        .dma_test_irq           = sgiioc4_dma_test_irq,
        .dma_lost_irq           = sgiioc4_dma_lost_irq,
-       .dma_timeout            = ide_dma_timeout,
 };
 
 static const struct ide_port_info sgiioc4_port_info __devinitconst = {
index 075cb1243b2a6a117e1eaa7324b3805973166417..e4973cd1fba9e8735191f73e32e3eb9575f1d97d 100644 (file)
@@ -715,7 +715,6 @@ static const struct ide_dma_ops sil_dma_ops = {
        .dma_end                = ide_dma_end,
        .dma_test_irq           = siimage_dma_test_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
index d25137b04e7a2d357bba29c7d798b864d55ad629..d6f8977191c85600aad34a2d12debbfb4268d55a 100644 (file)
@@ -189,14 +189,13 @@ static void sl82c105_dma_start(ide_drive_t *drive)
        ide_dma_start(drive);
 }
 
-static void sl82c105_dma_timeout(ide_drive_t *drive)
+static void sl82c105_dma_clear(ide_drive_t *drive)
 {
        struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
 
-       DBG(("sl82c105_dma_timeout(drive:%s)\n", drive->name));
+       DBG(("sl82c105_dma_clear(drive:%s)\n", drive->name));
 
        sl82c105_reset_host(dev);
-       ide_dma_timeout(drive);
 }
 
 static int sl82c105_dma_end(ide_drive_t *drive)
@@ -298,7 +297,7 @@ static const struct ide_dma_ops sl82c105_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = sl82c105_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = sl82c105_dma_timeout,
+       .dma_clear              = sl82c105_dma_clear,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index 427d4b3c2c636d37c3888464c3ce42b37290e7c8..b4cf42dc8a6fcf4cd155ae0bd3f7ad9868a10106 100644 (file)
@@ -187,7 +187,6 @@ static const struct ide_dma_ops tc86c001_dma_ops = {
        .dma_test_irq           = ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = ide_dma_sff_read_status,
 };
 
index ed1496845a9395b379d5b572d6ac098ec5457ca4..d6a950828e9f1f518704f8dd8c94195e3c91ddd3 100644 (file)
@@ -314,7 +314,6 @@ static struct ide_dma_ops trm290_dma_ops = {
        .dma_end                = trm290_dma_end,
        .dma_test_irq           = trm290_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
-       .dma_timeout            = ide_dma_timeout,
 };
 
 static const struct ide_port_info trm290_chipset __devinitdata = {
index e0e0a803dde38d92de14f620eb5f3fe798d1bd69..53f99853b065dbfc38b7fd45aafd8fe7d825d7b3 100644 (file)
@@ -632,7 +632,6 @@ static const struct ide_dma_ops tx4939ide_dma_ops = {
        .dma_test_irq           = tx4939ide_dma_test_irq,
        .dma_lost_irq           = ide_dma_lost_irq,
        .dma_timer_expiry       = ide_dma_sff_timer_expiry,
-       .dma_timeout            = ide_dma_timeout,
        .dma_sff_read_status    = tx4939ide_dma_sff_read_status,
 };
 
index cb501bf78f7d2afe4770b568769c17df6f59fe1b..d3035f2f12503a6d1f68b06ef110ed264215fb9c 100644 (file)
@@ -716,8 +716,9 @@ struct ide_dma_ops {
        int     (*dma_end)(struct ide_drive_s *);
        int     (*dma_test_irq)(struct ide_drive_s *);
        void    (*dma_lost_irq)(struct ide_drive_s *);
+       /* below ones are optional */
        int     (*dma_timer_expiry)(struct ide_drive_s *);
-       void    (*dma_timeout)(struct ide_drive_s *);
+       void    (*dma_clear)(struct ide_drive_s *);
        /*
         * The following method is optional and only required to be
         * implemented for the SFF-8038i compatible controllers.
@@ -1461,7 +1462,6 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
 #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
 
 void ide_dma_lost_irq(ide_drive_t *);
-void ide_dma_timeout(ide_drive_t *);
 ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
 
 #else