All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: bzolnier@gmail.com
Cc: linux-ide@vger.kernel.org
Subject: [PATCH pata-2.6 fix queue] aec62xx: remove init_dma() method
Date: Sat, 12 May 2007 01:11:41 +0400	[thread overview]
Message-ID: <200705120111.41950.sshtylyov@ru.mvista.com> (raw)
In-Reply-To: <200702162321.40813.sshtylyov@ru.mvista.com>

Get rid of the init_dma() method (which had no particular reason to exist) by
folding it into the init_hwif() method. While at it, also perform some cleanup
in the latter method:

- get rid of the useless clearing of hwif->autodma;

- fold the serialization code into one 'if' statement;

- fold setting the drives' 'autotune' and 'autodma' fields into the single
  statements...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
The patch should apply somewhere near the start of pata-2.6 patchset.
Warning: the patch has only been compile tested.

 drivers/ide/pci/aec62xx.c |   63 ++++++++++++++++++----------------------------
 1 files changed, 26 insertions(+), 37 deletions(-)

Index: linux-2.6/drivers/ide/pci/aec62xx.c
===================================================================
--- linux-2.6.orig/drivers/ide/pci/aec62xx.c
+++ linux-2.6/drivers/ide/pci/aec62xx.c
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/aec62xx.c		Version 0.22	Apr 23, 2007
+ * linux/drivers/ide/pci/aec62xx.c		Version 0.23	Apr 27, 2007
  *
  * Copyright (C) 1999-2002	Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2007		MontaVista Software, Inc. <source@mvista.com>
@@ -224,21 +224,18 @@ static unsigned int __devinit init_chips
 
 static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
 {
-	struct pci_dev *dev = hwif->pci_dev;
+	struct pci_dev *dev	= hwif->pci_dev;
+	u8 reg54 = 0,  mask	= hwif->channel ? 0xf0 : 0x0f;
+	unsigned long flags;
 
-	hwif->autodma = 0;
 	hwif->tuneproc = &aec62xx_tune_drive;
 	hwif->speedproc = &aec62xx_tune_chipset;
 
-	if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
-		hwif->serialized = hwif->channel;
-
-	if (hwif->mate)
-		hwif->mate->serialized = hwif->serialized;
+	if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF && hwif->mate)
+		hwif->mate->serialized = hwif->serialized = 1;
 
 	if (!hwif->dma_base) {
-		hwif->drives[0].autotune = 1;
-		hwif->drives[1].autotune = 1;
+		hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
 		return;
 	}
 
@@ -248,32 +245,29 @@ static void __devinit init_hwif_aec62xx(
 	hwif->ide_dma_check	= &aec62xx_config_drive_xfer_rate;
 	hwif->ide_dma_lostirq	= &aec62xx_irq_timeout;
 
-	if (!noautodma)
-		hwif->autodma = 1;
-	hwif->drives[0].autodma = hwif->autodma;
-	hwif->drives[1].autodma = hwif->autodma;
-}
-
-static void __devinit init_dma_aec62xx(ide_hwif_t *hwif, unsigned long dmabase)
-{
-	struct pci_dev *dev	= hwif->pci_dev;
-
-	if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
-		u8 reg54h = 0;
-		unsigned long flags;
-
+	switch (dev->device) {
+	case PCI_DEVICE_ID_ARTOP_ATP850UF:
 		spin_lock_irqsave(&ide_lock, flags);
-		pci_read_config_byte(dev, 0x54, &reg54h);
-		pci_write_config_byte(dev, 0x54, reg54h & ~(hwif->channel ? 0xF0 : 0x0F));
+		pci_read_config_byte (dev, 0x54, &reg54);
+		pci_write_config_byte(dev, 0x54, (reg54 & ~mask));
 		spin_unlock_irqrestore(&ide_lock, flags);
-	} else {
-		u8 ata66	= 0;
-		pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
-	        if (!(hwif->udma_four))
-			hwif->udma_four = (ata66&(hwif->channel?0x02:0x01))?0:1;
+		break;
+	case PCI_DEVICE_ID_ARTOP_ATP865:
+	case PCI_DEVICE_ID_ARTOP_ATP865R:
+	case PCI_DEVICE_ID_ARTOP_ATP860:
+	case PCI_DEVICE_ID_ARTOP_ATP860R:
+	        if (!hwif->udma_four) {
+			u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01;
+
+			pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
+			hwif->udma_four = (ata66 & mask) ? 0 : 1;
+		}
+		break;
 	}
 
-	ide_setup_dma(hwif, dmabase, 8);
+	if (!noautodma)
+		hwif->autodma = 1;
+	hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
 }
 
 static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d)
@@ -300,7 +294,6 @@ static ide_pci_device_t aec62xx_chipsets
 		.init_setup	= init_setup_aec62xx,
 		.init_chipset	= init_chipset_aec62xx,
 		.init_hwif	= init_hwif_aec62xx,
-		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
@@ -311,7 +304,6 @@ static ide_pci_device_t aec62xx_chipsets
 		.init_setup	= init_setup_aec62xx,
 		.init_chipset	= init_chipset_aec62xx,
 		.init_hwif	= init_hwif_aec62xx,
-		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= NOAUTODMA,
 		.bootable	= OFF_BOARD,
@@ -321,7 +313,6 @@ static ide_pci_device_t aec62xx_chipsets
 		.init_setup	= init_setup_aec62xx,
 		.init_chipset	= init_chipset_aec62xx,
 		.init_hwif	= init_hwif_aec62xx,
-		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
@@ -332,7 +323,6 @@ static ide_pci_device_t aec62xx_chipsets
 		.init_setup	= init_setup_aec6x80,
 		.init_chipset	= init_chipset_aec62xx,
 		.init_hwif	= init_hwif_aec62xx,
-		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.bootable	= OFF_BOARD,
@@ -342,7 +332,6 @@ static ide_pci_device_t aec62xx_chipsets
 		.init_setup	= init_setup_aec6x80,
 		.init_chipset	= init_chipset_aec62xx,
 		.init_hwif	= init_hwif_aec62xx,
-		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},


  parent reply	other threads:[~2007-05-11 21:10 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-03 20:09 [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup Sergei Shtylyov
2007-02-03 21:04 ` [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup (take 2) Sergei Shtylyov
2007-02-03 22:25   ` Bartlomiej Zolnierkiewicz
2007-02-05 13:29     ` Sergei Shtylyov
2007-02-05 13:57       ` Sergei Shtylyov
     [not found]         ` <58cb370e0702061459r1b001421gb4592d066793ab46@mail.gmail.com>
2007-02-06 23:44           ` Bartlomiej Zolnierkiewicz
2007-02-07 12:50             ` Sergei Shtylyov
     [not found]       ` <58cb370e0702061459k4a147891v3686b267d8e3001a@mail.gmail.com>
2007-02-06 23:33         ` Bartlomiej Zolnierkiewicz
2007-02-06 14:45   ` [PATCH] (2.6.20) cmd64x: fix PIO mode setup (take 3) Sergei Shtylyov
2007-02-06 21:11     ` Mikael Pettersson
2007-02-07  0:28       ` Bartlomiej Zolnierkiewicz
     [not found]     ` <58cb370e0702061500g3047b8ccpca894962491b588a@mail.gmail.com>
2007-02-06 23:48       ` Bartlomiej Zolnierkiewicz
2007-02-09 22:29   ` [PATCH] (pata-2.6 fix queue) cmd64x: fix recovery time calculation Sergei Shtylyov
2007-02-10  0:14     ` Bartlomiej Zolnierkiewicz
2007-02-14 21:42   ` [PATCH] (pata-2.6 fix queue) cmd64x: interrupt status fixes Sergei Shtylyov
2007-02-14 22:35   ` [PATCH] (pata-2.6 fix queue) cmd64x: add/fix enablebits Sergei Shtylyov
2007-02-19 23:09     ` Bartlomiej Zolnierkiewicz
2007-02-20 14:28       ` Sergei Shtylyov
2007-02-23 20:10         ` Bartlomiej Zolnierkiewicz
2007-04-14 19:31     ` [PATCH pata-2.6] cmd64x: add/fix enablebits (take 2) Sergei Shtylyov
2007-04-23 21:54       ` Bartlomiej Zolnierkiewicz
2007-02-15 13:53   ` [PATCH] (pata-2.6 fix queue) cmd64x: interrupt status fixes (resend) Sergei Shtylyov
2007-02-19 23:04     ` Bartlomiej Zolnierkiewicz
2007-04-14 19:17     ` [PATCH pata-2.6] cmd64x: interrupt status fixes (take 2) Sergei Shtylyov
2007-04-23 21:52       ` Bartlomiej Zolnierkiewicz
2007-02-15 19:17   ` [PATCH] (pata-2.6 fix queue) cmd64x: procfs code fixes/cleanups Sergei Shtylyov
2007-02-19 23:10     ` Bartlomiej Zolnierkiewicz
2007-04-14 19:41     ` [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) Sergei Shtylyov
2007-04-23 21:58       ` Bartlomiej Zolnierkiewicz
2007-02-16 20:15   ` [PATCH] (pata-2.6 fix queue) cmd64x: Sergei Shtylyov
2007-02-16 20:21   ` [PATCH] (pata-2.6 fix queue) cmd64x: use interrupt status from MRDMODE register Sergei Shtylyov
2007-02-23 20:09     ` Bartlomiej Zolnierkiewicz
2007-04-14 19:53     ` [PATCH pata-2.6] cmd64x: use interrupt status from MRDMODE register (take 2) Sergei Shtylyov
2007-04-23 22:03       ` Bartlomiej Zolnierkiewicz
2007-04-18 19:38     ` [PATCH pata-2.6 fix queue] hpt366: fix kernel oops with HPT302N Sergei Shtylyov
2007-04-20 19:54       ` Bartlomiej Zolnierkiewicz
2007-04-22 18:05     ` [PATCH pata-2.6 fix queue] aec62xx: fix PIO/DMA setup issues Sergei Shtylyov
2007-04-23 22:33       ` Bartlomiej Zolnierkiewicz
2007-05-10 20:01     ` [PATCH pata-2.6 fix queue] cmd64x: init. code cleanup Sergei Shtylyov
2007-05-10 20:04     ` Sergei Shtylyov
2007-05-15 21:16       ` Bartlomiej Zolnierkiewicz
2007-05-11 19:31     ` [PATCH pata-2.6 fix queue] aec62xx: rework init_setup_aec6x80() Sergei Shtylyov
2007-05-15 21:31       ` Bartlomiej Zolnierkiewicz
2007-05-11 21:11     ` Sergei Shtylyov [this message]
2007-05-15 21:40       ` [PATCH pata-2.6 fix queue] aec62xx: remove init_dma() method Bartlomiej Zolnierkiewicz
2007-05-11 21:22     ` [PATCH pata-2.6 fix queue] aec62xx: kill speedproc() method wrapper Sergei Shtylyov
2007-05-15 21:43       ` Bartlomiej Zolnierkiewicz
2007-05-16 14:20         ` Sergei Shtylyov
2007-05-23 23:33           ` Bartlomiej Zolnierkiewicz
2007-05-24 13:18             ` Sergei Shtylyov
2007-05-24 16:44     ` [PATCH pata-2.6] aec62xx: remove init_dma() method (take 2) Sergei Shtylyov
2007-05-24 16:46     ` [PATCH pata-2.6] aec62xx: kill speedproc() method wrapper " Sergei Shtylyov
2007-05-28 20:44       ` Bartlomiej Zolnierkiewicz
2007-06-05 15:15         ` Sergei Shtylyov
2007-06-08 12:22           ` Bartlomiej Zolnierkiewicz
2007-06-09 10:05             ` Sergei Shtylyov
2007-11-09 11:07     ` [PATCH] cmd64x: don't clear the other channels interrupt Sergei Shtylyov
2007-11-11 21:52       ` Bartlomiej Zolnierkiewicz
2007-11-13 20:58         ` Bartlomiej Zolnierkiewicz
2007-11-15 19:23           ` Martin Rogge
2007-11-16 13:34           ` Sergei Shtylyov
2007-02-26 20:32   ` [PATCH] (pata-2.6 fix queue) cmd64x: fix recovery time calculation (take 2) Sergei Shtylyov
2007-03-02 20:34     ` Bartlomiej Zolnierkiewicz
2007-03-03 20:17     ` [PATCH pata-2.6 fix queue] cmd64x: fix recovery time calculation (take 3) Sergei Shtylyov
2007-03-15 20:29       ` Bartlomiej Zolnierkiewicz
2007-02-27 21:49   ` [PATCH] (pata-2.6 fix queue) cmd64x: fix primary channel address setup time Sergei Shtylyov
2007-02-28 13:27     ` Sergei Shtylyov
2007-02-28 20:52   ` [PATCH] (pata-2.6 fix queue) cmd64x: add back MWDMA support Sergei Shtylyov
2007-03-02 22:03     ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705120111.41950.sshtylyov@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.