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

Bartlomiej Zolnierkiewicz
2009-11-25T17:03:43Z

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(-)

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)