aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt3x2n.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-03-24 23:22:49 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:17 -0400
commit887125e3740283be25564bfc6fb5d24974b651ab (patch)
treebd037e1c17a468fabe1834e707b70b4b43513e4a /drivers/ata/pata_hpt3x2n.c
parent1bd5b715a305f6f13455e89becbd839010dd14b5 (diff)
libata: stop overloading port_info->private_data
port_info->private_data is currently used for two purposes - to record private data about the port_info or to specify host->private_data to use when allocating ata_host. This overloading is confusing and counter-intuitive in that port_info->private_data becomes host->private_data instead of port->private_data. In addition, port_info and host don't correspond to each other 1-to-1. Currently, the first non-NULL port_info->private_data is used. This patch makes port_info->private_data just be what it is - private_data for the port_info where LLD can jot down extra info. libata no longer sets host->private_data to the first non-NULL port_info->private_data, @host_priv argument is added to ata_pci_init_one() instead. LLDs which use ata_pci_init_one() can use this argument to pass in pointer to host private data. LLDs which don't should use init-register model anyway and can initialize host->private_data directly. Adding @host_priv instead of using init-register model for LLDs which use ata_pci_init_one() is suggested by Alan Cox. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Diffstat (limited to 'drivers/ata/pata_hpt3x2n.c')
-rw-r--r--drivers/ata/pata_hpt3x2n.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 2c178c30116c..c774be93ae04 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -458,8 +458,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
458 .udma_mask = ATA_UDMA6, 458 .udma_mask = ATA_UDMA6,
459 .port_ops = &hpt3x2n_port_ops 459 .port_ops = &hpt3x2n_port_ops
460 }; 460 };
461 struct ata_port_info port = info; 461 const struct ata_port_info *ppi[] = { &info, NULL };
462 const struct ata_port_info *ppi[] = { &port, NULL };
463 462
464 u8 irqmask; 463 u8 irqmask;
465 u32 class_rev; 464 u32 class_rev;
@@ -468,6 +467,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
468 unsigned int f_low, f_high; 467 unsigned int f_low, f_high;
469 int adjust; 468 int adjust;
470 unsigned long iobase = pci_resource_start(dev, 4); 469 unsigned long iobase = pci_resource_start(dev, 4);
470 void *hpriv = NULL;
471 int rc; 471 int rc;
472 472
473 rc = pcim_enable_device(dev); 473 rc = pcim_enable_device(dev);
@@ -554,9 +554,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
554 pci_mhz); 554 pci_mhz);
555 /* Set our private data up. We only need a few flags so we use 555 /* Set our private data up. We only need a few flags so we use
556 it directly */ 556 it directly */
557 port.private_data = NULL;
558 if (pci_mhz > 60) { 557 if (pci_mhz > 60) {
559 port.private_data = (void *)PCI66; 558 hpriv = (void *)PCI66;
560 /* 559 /*
561 * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in 560 * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in
562 * the MISC. register to stretch the UltraDMA Tss timing. 561 * the MISC. register to stretch the UltraDMA Tss timing.
@@ -567,7 +566,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
567 } 566 }
568 567
569 /* Now kick off ATA set up */ 568 /* Now kick off ATA set up */
570 return ata_pci_init_one(dev, ppi, &hpt3x2n_sht); 569 return ata_pci_init_one(dev, ppi, &hpt3x2n_sht, hpriv);
571} 570}
572 571
573static const struct pci_device_id hpt3x2n[] = { 572static const struct pci_device_id hpt3x2n[] = {