aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-04-17 10:44:08 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:06 -0400
commit6bfff31e77cfa1b13490337e5a4dbaa3407e83ac (patch)
tree89f7dc5379453381aed939741fc3a7e46b0465fa /drivers
parent5d728824efeda61d304153bfcf1378a3c18b7d70 (diff)
libata: kill probe_ent and related helpers
All drivers are converted to new init model. Kill probe_ent, ata_device_add() and ata_pci_init_native_mode(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c153
-rw-r--r--drivers/ata/libata-sff.c95
-rw-r--r--drivers/ata/libata.h2
3 files changed, 0 insertions, 250 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2a38aa2841fd..b5839f84b384 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6133,131 +6133,6 @@ int ata_host_activate(struct ata_host *host, int irq,
6133} 6133}
6134 6134
6135/** 6135/**
6136 * ata_device_add - Register hardware device with ATA and SCSI layers
6137 * @ent: Probe information describing hardware device to be registered
6138 *
6139 * This function processes the information provided in the probe
6140 * information struct @ent, allocates the necessary ATA and SCSI
6141 * host information structures, initializes them, and registers
6142 * everything with requisite kernel subsystems.
6143 *
6144 * This function requests irqs, probes the ATA bus, and probes
6145 * the SCSI bus.
6146 *
6147 * LOCKING:
6148 * PCI/etc. bus probe sem.
6149 *
6150 * RETURNS:
6151 * Number of ports registered. Zero on error (no ports registered).
6152 */
6153int ata_device_add(const struct ata_probe_ent *ent)
6154{
6155 unsigned int i;
6156 struct device *dev = ent->dev;
6157 struct ata_host *host;
6158 int rc;
6159
6160 DPRINTK("ENTER\n");
6161
6162 if (ent->irq == 0) {
6163 dev_printk(KERN_ERR, dev, "is not available: No interrupt assigned.\n");
6164 return 0;
6165 }
6166
6167 if (!ent->port_ops->error_handler &&
6168 !(ent->port_flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST))) {
6169 dev_printk(KERN_ERR, dev, "no reset mechanism available\n");
6170 return 0;
6171 }
6172
6173 if (!devres_open_group(dev, ata_device_add, GFP_KERNEL))
6174 return 0;
6175
6176 /* allocate host */
6177 host = ata_host_alloc(dev, ent->n_ports);
6178
6179 host->irq = ent->irq;
6180 host->irq2 = ent->irq2;
6181 host->iomap = ent->iomap;
6182 host->private_data = ent->private_data;
6183 host->ops = ent->port_ops;
6184 host->flags = ent->_host_flags;
6185
6186 for (i = 0; i < host->n_ports; i++) {
6187 struct ata_port *ap = host->ports[i];
6188
6189 /* dummy? */
6190 if (ent->dummy_port_mask & (1 << i)) {
6191 ap->ops = &ata_dummy_port_ops;
6192 continue;
6193 }
6194
6195 if (ap->port_no == 1 && ent->pinfo2) {
6196 ap->pio_mask = ent->pinfo2->pio_mask;
6197 ap->mwdma_mask = ent->pinfo2->mwdma_mask;
6198 ap->udma_mask = ent->pinfo2->udma_mask;
6199 ap->flags |= ent->pinfo2->flags;
6200 ap->ops = ent->pinfo2->port_ops;
6201 } else {
6202 ap->pio_mask = ent->pio_mask;
6203 ap->mwdma_mask = ent->mwdma_mask;
6204 ap->udma_mask = ent->udma_mask;
6205 ap->flags |= ent->port_flags;
6206 ap->ops = ent->port_ops;
6207 }
6208
6209 memcpy(&ap->ioaddr, &ent->port[ap->port_no],
6210 sizeof(struct ata_ioports));
6211 }
6212
6213 /* start and freeze ports before requesting IRQ */
6214 rc = ata_host_start(host);
6215 if (rc)
6216 goto err_out;
6217
6218 /* obtain irq, that may be shared between channels */
6219 rc = devm_request_irq(dev, ent->irq, ent->port_ops->irq_handler,
6220 ent->irq_flags, DRV_NAME, host);
6221 if (rc) {
6222 dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n",
6223 ent->irq, rc);
6224 goto err_out;
6225 }
6226
6227 /* do we have a second IRQ for the other channel, eg legacy mode */
6228 if (ent->irq2) {
6229 /* We will get weird core code crashes later if this is true
6230 so trap it now */
6231 BUG_ON(ent->irq == ent->irq2);
6232
6233 rc = devm_request_irq(dev, ent->irq2,
6234 ent->port_ops->irq_handler, ent->irq_flags,
6235 DRV_NAME, host);
6236 if (rc) {
6237 dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n",
6238 ent->irq2, rc);
6239 goto err_out;
6240 }
6241 }
6242
6243 /* resource acquisition complete */
6244 devres_remove_group(dev, ata_device_add);
6245
6246 /* register */
6247 rc = ata_host_register(host, ent->sht);
6248 if (rc)
6249 goto err_out;
6250
6251 VPRINTK("EXIT, returning %u\n", host->n_ports);
6252 return host->n_ports; /* success */
6253
6254 err_out:
6255 devres_release_group(dev, ata_device_add);
6256 VPRINTK("EXIT, returning 0\n");
6257 return 0;
6258}
6259
6260/**
6261 * ata_port_detach - Detach ATA port in prepration of device removal 6136 * ata_port_detach - Detach ATA port in prepration of device removal
6262 * @ap: ATA port to be detached 6137 * @ap: ATA port to be detached
6263 * 6138 *
@@ -6332,32 +6207,6 @@ void ata_host_detach(struct ata_host *host)
6332 ata_port_detach(host->ports[i]); 6207 ata_port_detach(host->ports[i]);
6333} 6208}
6334 6209
6335struct ata_probe_ent *
6336ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
6337{
6338 struct ata_probe_ent *probe_ent;
6339
6340 probe_ent = devm_kzalloc(dev, sizeof(*probe_ent), GFP_KERNEL);
6341 if (!probe_ent) {
6342 printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
6343 kobject_name(&(dev->kobj)));
6344 return NULL;
6345 }
6346
6347 INIT_LIST_HEAD(&probe_ent->node);
6348 probe_ent->dev = dev;
6349
6350 probe_ent->sht = port->sht;
6351 probe_ent->port_flags = port->flags;
6352 probe_ent->pio_mask = port->pio_mask;
6353 probe_ent->mwdma_mask = port->mwdma_mask;
6354 probe_ent->udma_mask = port->udma_mask;
6355 probe_ent->port_ops = port->port_ops;
6356 probe_ent->private_data = port->private_data;
6357
6358 return probe_ent;
6359}
6360
6361/** 6210/**
6362 * ata_std_ports - initialize ioaddr with standard port offsets. 6211 * ata_std_ports - initialize ioaddr with standard port offsets.
6363 * @ioaddr: IO address structure to be initialized 6212 * @ioaddr: IO address structure to be initialized
@@ -6647,7 +6496,6 @@ EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
6647EXPORT_SYMBOL_GPL(ata_host_start); 6496EXPORT_SYMBOL_GPL(ata_host_start);
6648EXPORT_SYMBOL_GPL(ata_host_register); 6497EXPORT_SYMBOL_GPL(ata_host_register);
6649EXPORT_SYMBOL_GPL(ata_host_activate); 6498EXPORT_SYMBOL_GPL(ata_host_activate);
6650EXPORT_SYMBOL_GPL(ata_device_add);
6651EXPORT_SYMBOL_GPL(ata_host_detach); 6499EXPORT_SYMBOL_GPL(ata_host_detach);
6652EXPORT_SYMBOL_GPL(ata_sg_init); 6500EXPORT_SYMBOL_GPL(ata_sg_init);
6653EXPORT_SYMBOL_GPL(ata_sg_init_one); 6501EXPORT_SYMBOL_GPL(ata_sg_init_one);
@@ -6730,7 +6578,6 @@ EXPORT_SYMBOL_GPL(ata_timing_merge);
6730 6578
6731#ifdef CONFIG_PCI 6579#ifdef CONFIG_PCI
6732EXPORT_SYMBOL_GPL(pci_test_config_bits); 6580EXPORT_SYMBOL_GPL(pci_test_config_bits);
6733EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
6734EXPORT_SYMBOL_GPL(ata_pci_init_native_host); 6581EXPORT_SYMBOL_GPL(ata_pci_init_native_host);
6735EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host); 6582EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host);
6736EXPORT_SYMBOL_GPL(ata_pci_init_one); 6583EXPORT_SYMBOL_GPL(ata_pci_init_one);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 142120cab874..8af18ad1ca7f 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -533,101 +533,6 @@ static int ata_resources_present(struct pci_dev *pdev, int port)
533} 533}
534 534
535/** 535/**
536 * ata_pci_init_native_mode - Initialize native-mode driver
537 * @pdev: pci device to be initialized
538 * @port: array[2] of pointers to port info structures.
539 * @ports: bitmap of ports present
540 *
541 * Utility function which allocates and initializes an
542 * ata_probe_ent structure for a standard dual-port
543 * PIO-based IDE controller. The returned ata_probe_ent
544 * structure can be passed to ata_device_add(). The returned
545 * ata_probe_ent structure should then be freed with kfree().
546 *
547 * The caller need only pass the address of the primary port, the
548 * secondary will be deduced automatically. If the device has non
549 * standard secondary port mappings this function can be called twice,
550 * once for each interface.
551 */
552
553struct ata_probe_ent *
554ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int ports)
555{
556 struct ata_probe_ent *probe_ent;
557 int i;
558 void __iomem * const *iomap;
559
560 /* Discard disabled ports. Some controllers show their unused
561 * channels this way. Disabled ports will be made dummy.
562 */
563 if (ata_resources_present(pdev, 0) == 0)
564 ports &= ~ATA_PORT_PRIMARY;
565 if (ata_resources_present(pdev, 1) == 0)
566 ports &= ~ATA_PORT_SECONDARY;
567
568 if (!ports) {
569 dev_printk(KERN_ERR, &pdev->dev, "no available port\n");
570 return NULL;
571 }
572
573 /* iomap BARs */
574 for (i = 0; i < 4; i++) {
575 if (!(ports & (1 << (i / 2))))
576 continue;
577 if (pcim_iomap(pdev, i, 0) == NULL) {
578 dev_printk(KERN_ERR, &pdev->dev,
579 "failed to iomap PCI BAR %d\n", i);
580 return NULL;
581 }
582 }
583
584 pcim_iomap(pdev, 4, 0); /* may fail */
585 iomap = pcim_iomap_table(pdev);
586
587 /* alloc and init probe_ent */
588 probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]);
589 if (!probe_ent)
590 return NULL;
591
592 probe_ent->n_ports = 2;
593 probe_ent->irq = pdev->irq;
594 probe_ent->irq_flags = IRQF_SHARED;
595
596 if (ports & ATA_PORT_PRIMARY) {
597 probe_ent->port[0].cmd_addr = iomap[0];
598 probe_ent->port[0].altstatus_addr =
599 probe_ent->port[0].ctl_addr = (void __iomem *)
600 ((unsigned long)iomap[1] | ATA_PCI_CTL_OFS);
601 if (iomap[4]) {
602 if ((!(port[0]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
603 (ioread8(iomap[4] + 2) & 0x80))
604 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
605 probe_ent->port[0].bmdma_addr = iomap[4];
606 }
607 ata_std_ports(&probe_ent->port[0]);
608 } else
609 probe_ent->dummy_port_mask |= ATA_PORT_PRIMARY;
610
611 if (ports & ATA_PORT_SECONDARY) {
612 probe_ent->port[1].cmd_addr = iomap[2];
613 probe_ent->port[1].altstatus_addr =
614 probe_ent->port[1].ctl_addr = (void __iomem *)
615 ((unsigned long)iomap[3] | ATA_PCI_CTL_OFS);
616 if (iomap[4]) {
617 if ((!(port[1]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
618 (ioread8(iomap[4] + 10) & 0x80))
619 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
620 probe_ent->port[1].bmdma_addr = iomap[4] + 8;
621 }
622 ata_std_ports(&probe_ent->port[1]);
623 probe_ent->pinfo2 = port[1];
624 } else
625 probe_ent->dummy_port_mask |= ATA_PORT_SECONDARY;
626
627 return probe_ent;
628}
629
630/**
631 * ata_pci_init_bmdma - acquire PCI BMDMA resources and init ATA host 536 * ata_pci_init_bmdma - acquire PCI BMDMA resources and init ATA host
632 * @host: target ATA host 537 * @host: target ATA host
633 * 538 *
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index b4d5253d627a..5f4d40cd3288 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -93,8 +93,6 @@ extern int ata_flush_cache(struct ata_device *dev);
93extern void ata_dev_init(struct ata_device *dev); 93extern void ata_dev_init(struct ata_device *dev);
94extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); 94extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
95extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); 95extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
96extern struct ata_probe_ent *ata_probe_ent_alloc(struct device *dev,
97 const struct ata_port_info *port);
98extern struct ata_port *ata_port_alloc(struct ata_host *host); 96extern struct ata_port *ata_port_alloc(struct ata_host *host);
99 97
100/* libata-acpi.c */ 98/* libata-acpi.c */