Patchwork [06/86] pata_artop: unify ->prereset methods

login
register
mail settings
Submitter Bartlomiej Zolnierkiewicz
Date Nov. 25, 2009, 5:03 p.m.
Message ID <20091125170300.5446.25122.sendpatchset@localhost>
Download mbox | patch
Permalink /patch/39410/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Bartlomiej Zolnierkiewicz - Nov. 25, 2009, 5:03 p.m.
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_artop: unify ->prereset methods

We can use the same ->prereset method for ATP850 and ATP86xR chipsets.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ata/pata_artop.c |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: b/drivers/ata/pata_artop.c
===================================================================
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -39,30 +39,15 @@ 
 
 static int clock = 0;
 
-static int atp850_pre_reset(struct ata_link *link, unsigned long deadline)
-{
-	struct ata_port *ap = link->ap;
-	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-	const struct pci_bits artop_enable_bits[] = {
-		{ 0x4AU, 1U, 0x02UL, 0x02UL },	/* port 0 */
-		{ 0x4AU, 1U, 0x04UL, 0x04UL },	/* port 1 */
-	};
-
-	if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
-		return -ENOENT;
-
-	return ata_sff_prereset(link, deadline);
-}
-
 /**
- *	atp86x_pre_reset	-	probe begin
+ *	atp8xx_prereset	-	probe begin
  *	@link: link
  *	@deadline: deadline jiffies for the operation
  *
  *	Nothing complicated needed here.
  */
 
-static int atp86x_pre_reset(struct ata_link *link, unsigned long deadline)
+static int atp8xx_prereset(struct ata_link *link, unsigned long deadline)
 {
 	static const struct pci_bits artop_enable_bits[] = {
 		{ 0x4AU, 1U, 0x02UL, 0x02UL },	/* port 0 */
@@ -72,8 +57,9 @@  static int atp86x_pre_reset(struct ata_l
 	struct ata_port *ap = link->ap;
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
 
-	/* Odd numbered device ids are the units with enable bits (the -R cards) */
-	if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
+	/* Odd numbered device ids are the units with enable bits. */
+	if (pdev->device % 1 &&
+	    !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no]))
 		return -ENOENT;
 
 	return ata_sff_prereset(link, deadline);
@@ -317,7 +303,7 @@  static struct ata_port_operations atp850
 	.cable_detect		= ata_cable_40wire,
 	.set_piomode		= atp850_set_piomode,
 	.set_dmamode		= atp850_set_dmamode,
-	.prereset		= atp850_pre_reset,
+	.prereset		= atp8xx_prereset,
 	.qc_defer		= atp850_qc_defer,
 };
 
@@ -326,7 +312,7 @@  static struct ata_port_operations atp86x
 	.cable_detect		= atp86x_cable_detect,
 	.set_piomode		= atp86x_set_piomode,
 	.set_dmamode		= atp86x_set_dmamode,
-	.prereset		= atp86x_pre_reset,
+	.prereset		= atp8xx_prereset,
 };
 
 static void atp8xx_fixup(struct pci_dev *pdev)