diff options
author | Tejun Heo <htejun@gmail.com> | 2007-05-04 06:43:58 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-11 18:09:18 -0400 |
commit | 1626aeb881236c8cb022b5e4ca594146a951d669 (patch) | |
tree | 30f3457e4b5d76e62ee192fcc0d52b0ee8a829df /drivers/ata | |
parent | 920a4b1038e442700a1cfac77ea7e20bd615a2c3 (diff) |
libata: clean up SFF init mess
The intention of using port_mask in SFF init helpers was to eventually
support exoctic configurations such as combination of legacy and
native port on the same controller. This never became actually
necessary and the related code always has been subtly broken one way
or the other. Now that new init model is in place, there is no reason
to make common helpers capable of handling all corner cases. Exotic
cases can simply dealt within LLDs as necessary.
This patch removes port_mask handling in SFF init helpers. SFF init
helpers don't take n_ports argument and interpret it into port_mask
anymore. All information is carried via port_info. n_ports argument
is dropped and always two ports are allocated. LLD can tell SFF to
skip certain port by marking it dummy. Note that SFF code has been
treating unuvailable ports this way for a long time until recent
breakage fix from Linus and is consistent with how other drivers
handle with unavailable ports.
This fixes 1-port legacy host handling still broken after the recent
native mode fix and simplifies SFF init logic. The following changes
are made...
* ata_pci_init_native_host() and ata_init_legacy_host() both now try
to initialized whatever they can and mark failed ports dummy. They
return 0 if any port is successfully initialized.
* ata_pci_prepare_native_host() and ata_pci_init_one() now doesn't
take n_ports argument. All info should be specified via port_info
array. Always two ports are allocated.
* ata_pci_init_bmdma() exported to be used by LLDs in exotic cases.
* port_info handling in all LLDs are standardized - all port_info
arrays are const stack variable named ppi. Unless the second port
is different from the first, its port_info is specified as NULL
(tells libata that it's identical to the last non-NULL port_info).
* pata_hpt37x/hpt3x2n: don't modify static variable directly. Make an
on-stack copy instead as ata_piix does.
* pata_uli: It has 4 ports instead of 2. Don't use
ata_pci_prepare_native_host(). Allocate the host explicitly and use
init helpers. It's simple enough.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
42 files changed, 308 insertions, 306 deletions
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 0f19e3223358..c3d753296bc6 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -141,7 +141,7 @@ static int all_generic_ide; /* Set to claim all devices */ | |||
141 | static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 141 | static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
142 | { | 142 | { |
143 | u16 command; | 143 | u16 command; |
144 | static struct ata_port_info info = { | 144 | static const struct ata_port_info info = { |
145 | .sht = &generic_sht, | 145 | .sht = &generic_sht, |
146 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 146 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
147 | .pio_mask = 0x1f, | 147 | .pio_mask = 0x1f, |
@@ -149,7 +149,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
149 | .udma_mask = 0x3f, | 149 | .udma_mask = 0x3f, |
150 | .port_ops = &generic_port_ops | 150 | .port_ops = &generic_port_ops |
151 | }; | 151 | }; |
152 | static struct ata_port_info *port_info[2] = { &info, &info }; | 152 | const struct ata_port_info *ppi[] = { &info, NULL }; |
153 | 153 | ||
154 | /* Don't use the generic entry unless instructed to do so */ | 154 | /* Don't use the generic entry unless instructed to do so */ |
155 | if (id->driver_data == 1 && all_generic_ide == 0) | 155 | if (id->driver_data == 1 && all_generic_ide == 0) |
@@ -175,7 +175,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
175 | if (dev->vendor == PCI_VENDOR_ID_AL) | 175 | if (dev->vendor == PCI_VENDOR_ID_AL) |
176 | ata_pci_clear_simplex(dev); | 176 | ata_pci_clear_simplex(dev); |
177 | 177 | ||
178 | return ata_pci_init_one(dev, port_info, 2); | 178 | return ata_pci_init_one(dev, ppi); |
179 | } | 179 | } |
180 | 180 | ||
181 | static struct pci_device_id ata_generic[] = { | 181 | static struct pci_device_id ata_generic[] = { |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 4f5a0dc7fb9c..13b6b1df2ac4 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1030,7 +1030,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1030 | static int printed_version; | 1030 | static int printed_version; |
1031 | struct device *dev = &pdev->dev; | 1031 | struct device *dev = &pdev->dev; |
1032 | struct ata_port_info port_info[2]; | 1032 | struct ata_port_info port_info[2]; |
1033 | struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; | 1033 | const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; |
1034 | struct piix_host_priv *hpriv; | 1034 | struct piix_host_priv *hpriv; |
1035 | unsigned long port_flags; | 1035 | unsigned long port_flags; |
1036 | 1036 | ||
@@ -1089,7 +1089,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1089 | port_info[1].mwdma_mask = 0; | 1089 | port_info[1].mwdma_mask = 0; |
1090 | port_info[1].udma_mask = 0; | 1090 | port_info[1].udma_mask = 0; |
1091 | } | 1091 | } |
1092 | return ata_pci_init_one(pdev, ppinfo, 2); | 1092 | return ata_pci_init_one(pdev, ppi); |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | static int __init piix_init(void) | 1095 | static int __init piix_init(void) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bf8f65b09591..9cff5c506573 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -6856,6 +6856,7 @@ EXPORT_SYMBOL_GPL(ata_timing_merge); | |||
6856 | #ifdef CONFIG_PCI | 6856 | #ifdef CONFIG_PCI |
6857 | EXPORT_SYMBOL_GPL(pci_test_config_bits); | 6857 | EXPORT_SYMBOL_GPL(pci_test_config_bits); |
6858 | EXPORT_SYMBOL_GPL(ata_pci_init_native_host); | 6858 | EXPORT_SYMBOL_GPL(ata_pci_init_native_host); |
6859 | EXPORT_SYMBOL_GPL(ata_pci_init_bmdma); | ||
6859 | EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host); | 6860 | EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host); |
6860 | EXPORT_SYMBOL_GPL(ata_pci_init_one); | 6861 | EXPORT_SYMBOL_GPL(ata_pci_init_one); |
6861 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); | 6862 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index d211db6b35a2..e35d13466c69 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -544,7 +544,7 @@ static int ata_resources_present(struct pci_dev *pdev, int port) | |||
544 | * RETURNS: | 544 | * RETURNS: |
545 | * 0 on success, -errno otherwise. | 545 | * 0 on success, -errno otherwise. |
546 | */ | 546 | */ |
547 | static int ata_pci_init_bmdma(struct ata_host *host) | 547 | int ata_pci_init_bmdma(struct ata_host *host) |
548 | { | 548 | { |
549 | struct device *gdev = host->dev; | 549 | struct device *gdev = host->dev; |
550 | struct pci_dev *pdev = to_pci_dev(gdev); | 550 | struct pci_dev *pdev = to_pci_dev(gdev); |
@@ -566,7 +566,7 @@ static int ata_pci_init_bmdma(struct ata_host *host) | |||
566 | } | 566 | } |
567 | host->iomap = pcim_iomap_table(pdev); | 567 | host->iomap = pcim_iomap_table(pdev); |
568 | 568 | ||
569 | for (i = 0; i < host->n_ports; i++) { | 569 | for (i = 0; i < 2; i++) { |
570 | struct ata_port *ap = host->ports[i]; | 570 | struct ata_port *ap = host->ports[i]; |
571 | void __iomem *bmdma = host->iomap[4] + 8 * i; | 571 | void __iomem *bmdma = host->iomap[4] + 8 * i; |
572 | 572 | ||
@@ -585,54 +585,52 @@ static int ata_pci_init_bmdma(struct ata_host *host) | |||
585 | /** | 585 | /** |
586 | * ata_pci_init_native_host - acquire native ATA resources and init host | 586 | * ata_pci_init_native_host - acquire native ATA resources and init host |
587 | * @host: target ATA host | 587 | * @host: target ATA host |
588 | * @port_mask: ports to consider | ||
589 | * | 588 | * |
590 | * Acquire native PCI ATA resources for @host and initialize | 589 | * Acquire native PCI ATA resources for @host and initialize the |
591 | * @host accordoingly. | 590 | * first two ports of @host accordingly. Ports marked dummy are |
591 | * skipped and allocation failure makes the port dummy. | ||
592 | * | 592 | * |
593 | * LOCKING: | 593 | * LOCKING: |
594 | * Inherited from calling layer (may sleep). | 594 | * Inherited from calling layer (may sleep). |
595 | * | 595 | * |
596 | * RETURNS: | 596 | * RETURNS: |
597 | * 0 on success, -errno otherwise. | 597 | * 0 if at least one port is initialized, -ENODEV if no port is |
598 | * available. | ||
598 | */ | 599 | */ |
599 | int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | 600 | int ata_pci_init_native_host(struct ata_host *host) |
600 | { | 601 | { |
601 | struct device *gdev = host->dev; | 602 | struct device *gdev = host->dev; |
602 | struct pci_dev *pdev = to_pci_dev(gdev); | 603 | struct pci_dev *pdev = to_pci_dev(gdev); |
604 | unsigned int mask = 0; | ||
603 | int i, rc; | 605 | int i, rc; |
604 | 606 | ||
605 | /* Discard disabled ports. Some controllers show their unused | ||
606 | * channels this way. Disabled ports are made dummy. | ||
607 | */ | ||
608 | for (i = 0; i < 2; i++) { | ||
609 | if ((port_mask & (1 << i)) && !ata_resources_present(pdev, i)) { | ||
610 | host->ports[i]->ops = &ata_dummy_port_ops; | ||
611 | port_mask &= ~(1 << i); | ||
612 | } | ||
613 | } | ||
614 | |||
615 | if (!port_mask) { | ||
616 | dev_printk(KERN_ERR, gdev, "no available port\n"); | ||
617 | return -ENODEV; | ||
618 | } | ||
619 | |||
620 | /* request, iomap BARs and init port addresses accordingly */ | 607 | /* request, iomap BARs and init port addresses accordingly */ |
621 | for (i = 0; i < 2; i++) { | 608 | for (i = 0; i < 2; i++) { |
622 | struct ata_port *ap = host->ports[i]; | 609 | struct ata_port *ap = host->ports[i]; |
623 | int base = i * 2; | 610 | int base = i * 2; |
624 | void __iomem * const *iomap; | 611 | void __iomem * const *iomap; |
625 | 612 | ||
626 | if (!(port_mask & (1 << i))) | 613 | if (ata_port_is_dummy(ap)) |
614 | continue; | ||
615 | |||
616 | /* Discard disabled ports. Some controllers show | ||
617 | * their unused channels this way. Disabled ports are | ||
618 | * made dummy. | ||
619 | */ | ||
620 | if (!ata_resources_present(pdev, i)) { | ||
621 | ap->ops = &ata_dummy_port_ops; | ||
627 | continue; | 622 | continue; |
623 | } | ||
628 | 624 | ||
629 | rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME); | 625 | rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME); |
630 | if (rc) { | 626 | if (rc) { |
631 | dev_printk(KERN_ERR, gdev, "failed to request/iomap " | 627 | dev_printk(KERN_WARNING, gdev, |
632 | "BARs for port %d (errno=%d)\n", i, rc); | 628 | "failed to request/iomap BARs for port %d " |
629 | "(errno=%d)\n", i, rc); | ||
633 | if (rc == -EBUSY) | 630 | if (rc == -EBUSY) |
634 | pcim_pin_device(pdev); | 631 | pcim_pin_device(pdev); |
635 | return rc; | 632 | ap->ops = &ata_dummy_port_ops; |
633 | continue; | ||
636 | } | 634 | } |
637 | host->iomap = iomap = pcim_iomap_table(pdev); | 635 | host->iomap = iomap = pcim_iomap_table(pdev); |
638 | 636 | ||
@@ -641,6 +639,13 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | |||
641 | ap->ioaddr.ctl_addr = (void __iomem *) | 639 | ap->ioaddr.ctl_addr = (void __iomem *) |
642 | ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); | 640 | ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); |
643 | ata_std_ports(&ap->ioaddr); | 641 | ata_std_ports(&ap->ioaddr); |
642 | |||
643 | mask |= 1 << i; | ||
644 | } | ||
645 | |||
646 | if (!mask) { | ||
647 | dev_printk(KERN_ERR, gdev, "no available native port\n"); | ||
648 | return -ENODEV; | ||
644 | } | 649 | } |
645 | 650 | ||
646 | return 0; | 651 | return 0; |
@@ -649,8 +654,7 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | |||
649 | /** | 654 | /** |
650 | * ata_pci_prepare_native_host - helper to prepare native PCI ATA host | 655 | * ata_pci_prepare_native_host - helper to prepare native PCI ATA host |
651 | * @pdev: target PCI device | 656 | * @pdev: target PCI device |
652 | * @ppi: array of port_info | 657 | * @ppi: array of port_info, must be enough for two ports |
653 | * @n_ports: number of ports to allocate | ||
654 | * @r_host: out argument for the initialized ATA host | 658 | * @r_host: out argument for the initialized ATA host |
655 | * | 659 | * |
656 | * Helper to allocate ATA host for @pdev, acquire all native PCI | 660 | * Helper to allocate ATA host for @pdev, acquire all native PCI |
@@ -664,10 +668,9 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | |||
664 | */ | 668 | */ |
665 | int ata_pci_prepare_native_host(struct pci_dev *pdev, | 669 | int ata_pci_prepare_native_host(struct pci_dev *pdev, |
666 | const struct ata_port_info * const * ppi, | 670 | const struct ata_port_info * const * ppi, |
667 | int n_ports, struct ata_host **r_host) | 671 | struct ata_host **r_host) |
668 | { | 672 | { |
669 | struct ata_host *host; | 673 | struct ata_host *host; |
670 | unsigned int port_mask; | ||
671 | int rc; | 674 | int rc; |
672 | 675 | ||
673 | if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) | 676 | if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) |
@@ -681,11 +684,7 @@ int ata_pci_prepare_native_host(struct pci_dev *pdev, | |||
681 | goto err_out; | 684 | goto err_out; |
682 | } | 685 | } |
683 | 686 | ||
684 | port_mask = ATA_PORT_PRIMARY; | 687 | rc = ata_pci_init_native_host(host); |
685 | if (n_ports > 1) | ||
686 | port_mask |= ATA_PORT_SECONDARY; | ||
687 | |||
688 | rc = ata_pci_init_native_host(host, port_mask); | ||
689 | if (rc) | 688 | if (rc) |
690 | goto err_out; | 689 | goto err_out; |
691 | 690 | ||
@@ -777,8 +776,11 @@ static int ata_init_legacy_port(struct ata_port *ap, | |||
777 | /* iomap cmd and ctl ports */ | 776 | /* iomap cmd and ctl ports */ |
778 | legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8); | 777 | legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8); |
779 | legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1); | 778 | legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1); |
780 | if (!legacy_dr->cmd_addr[port_no] || !legacy_dr->ctl_addr[port_no]) | 779 | if (!legacy_dr->cmd_addr[port_no] || !legacy_dr->ctl_addr[port_no]) { |
780 | dev_printk(KERN_WARNING, host->dev, | ||
781 | "failed to map cmd/ctl ports\n"); | ||
781 | return -ENOMEM; | 782 | return -ENOMEM; |
783 | } | ||
782 | 784 | ||
783 | /* init IO addresses */ | 785 | /* init IO addresses */ |
784 | ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no]; | 786 | ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no]; |
@@ -792,19 +794,20 @@ static int ata_init_legacy_port(struct ata_port *ap, | |||
792 | /** | 794 | /** |
793 | * ata_init_legacy_host - acquire legacy ATA resources and init ATA host | 795 | * ata_init_legacy_host - acquire legacy ATA resources and init ATA host |
794 | * @host: target ATA host | 796 | * @host: target ATA host |
795 | * @legacy_mask: out parameter, mask indicating ports is in legacy mode | ||
796 | * @was_busy: out parameter, indicates whether any port was busy | 797 | * @was_busy: out parameter, indicates whether any port was busy |
797 | * | 798 | * |
798 | * Acquire legacy ATA resources for ports. | 799 | * Acquire legacy ATA resources for the first two ports of @host |
800 | * and initialize it accordingly. Ports marked dummy are skipped | ||
801 | * and resource acquistion failure makes the port dummy. | ||
799 | * | 802 | * |
800 | * LOCKING: | 803 | * LOCKING: |
801 | * Inherited from calling layer (may sleep). | 804 | * Inherited from calling layer (may sleep). |
802 | * | 805 | * |
803 | * RETURNS: | 806 | * RETURNS: |
804 | * 0 on success, -errno otherwise. | 807 | * 0 if at least one port is initialized, -ENODEV if no port is |
808 | * available. | ||
805 | */ | 809 | */ |
806 | static int ata_init_legacy_host(struct ata_host *host, | 810 | static int ata_init_legacy_host(struct ata_host *host, int *was_busy) |
807 | unsigned int *legacy_mask, int *was_busy) | ||
808 | { | 811 | { |
809 | struct device *gdev = host->dev; | 812 | struct device *gdev = host->dev; |
810 | struct ata_legacy_devres *legacy_dr; | 813 | struct ata_legacy_devres *legacy_dr; |
@@ -821,22 +824,23 @@ static int ata_init_legacy_host(struct ata_host *host, | |||
821 | devres_add(gdev, legacy_dr); | 824 | devres_add(gdev, legacy_dr); |
822 | 825 | ||
823 | for (i = 0; i < 2; i++) { | 826 | for (i = 0; i < 2; i++) { |
824 | *legacy_mask &= ~(1 << i); | 827 | if (ata_port_is_dummy(host->ports[i])) |
828 | continue; | ||
829 | |||
825 | rc = ata_init_legacy_port(host->ports[i], legacy_dr); | 830 | rc = ata_init_legacy_port(host->ports[i], legacy_dr); |
826 | if (rc == 0) | 831 | if (rc == 0) |
827 | legacy_dr->mask |= 1 << i; | 832 | legacy_dr->mask |= 1 << i; |
828 | else if (rc == -EBUSY) | 833 | else { |
829 | (*was_busy)++; | 834 | if (rc == -EBUSY) |
830 | } | 835 | (*was_busy)++; |
831 | |||
832 | if (!legacy_dr->mask) | ||
833 | return -EBUSY; | ||
834 | |||
835 | for (i = 0; i < 2; i++) | ||
836 | if (!(legacy_dr->mask & (1 << i))) | ||
837 | host->ports[i]->ops = &ata_dummy_port_ops; | 836 | host->ports[i]->ops = &ata_dummy_port_ops; |
837 | } | ||
838 | } | ||
838 | 839 | ||
839 | *legacy_mask |= legacy_dr->mask; | 840 | if (!legacy_dr->mask) { |
841 | dev_printk(KERN_ERR, gdev, "no available legacy port\n"); | ||
842 | return -ENODEV; | ||
843 | } | ||
840 | 844 | ||
841 | devres_remove_group(gdev, NULL); | 845 | devres_remove_group(gdev, NULL); |
842 | return 0; | 846 | return 0; |
@@ -875,7 +879,7 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
875 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); | 879 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); |
876 | BUG_ON(!legacy_dr); | 880 | BUG_ON(!legacy_dr); |
877 | 881 | ||
878 | for (i = 0; i < host->n_ports; i++) { | 882 | for (i = 0; i < 2; i++) { |
879 | unsigned int irq; | 883 | unsigned int irq; |
880 | 884 | ||
881 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ | 885 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ |
@@ -923,8 +927,7 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
923 | /** | 927 | /** |
924 | * ata_pci_init_one - Initialize/register PCI IDE host controller | 928 | * ata_pci_init_one - Initialize/register PCI IDE host controller |
925 | * @pdev: Controller to be initialized | 929 | * @pdev: Controller to be initialized |
926 | * @port_info: Information from low-level host driver | 930 | * @ppi: array of port_info, must be enough for two ports |
927 | * @n_ports: Number of ports attached to host controller | ||
928 | * | 931 | * |
929 | * This is a helper function which can be called from a driver's | 932 | * This is a helper function which can be called from a driver's |
930 | * xxx_init_one() probe function if the hardware uses traditional | 933 | * xxx_init_one() probe function if the hardware uses traditional |
@@ -944,26 +947,34 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
944 | * RETURNS: | 947 | * RETURNS: |
945 | * Zero on success, negative on errno-based value on error. | 948 | * Zero on success, negative on errno-based value on error. |
946 | */ | 949 | */ |
947 | 950 | int ata_pci_init_one(struct pci_dev *pdev, | |
948 | int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 951 | const struct ata_port_info * const * ppi) |
949 | unsigned int n_ports) | ||
950 | { | 952 | { |
951 | struct device *dev = &pdev->dev; | 953 | struct device *dev = &pdev->dev; |
954 | const struct ata_port_info *pi = NULL; | ||
952 | struct ata_host *host = NULL; | 955 | struct ata_host *host = NULL; |
953 | const struct ata_port_info *port[2]; | ||
954 | u8 mask; | 956 | u8 mask; |
955 | unsigned int legacy_mode = 0; | 957 | int legacy_mode = 0; |
956 | int rc; | 958 | int i, rc; |
957 | 959 | ||
958 | DPRINTK("ENTER\n"); | 960 | DPRINTK("ENTER\n"); |
959 | 961 | ||
960 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) | 962 | /* look up the first valid port_info */ |
961 | return -ENOMEM; | 963 | for (i = 0; i < 2 && ppi[i]; i++) { |
964 | if (ppi[i]->port_ops != &ata_dummy_port_ops) { | ||
965 | pi = ppi[i]; | ||
966 | break; | ||
967 | } | ||
968 | } | ||
962 | 969 | ||
963 | BUG_ON(n_ports < 1 || n_ports > 2); | 970 | if (!pi) { |
971 | dev_printk(KERN_ERR, &pdev->dev, | ||
972 | "no valid port_info specified\n"); | ||
973 | return -EINVAL; | ||
974 | } | ||
964 | 975 | ||
965 | port[0] = port_info[0]; | 976 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) |
966 | port[1] = (n_ports > 1) ? port_info[1] : NULL; | 977 | return -ENOMEM; |
967 | 978 | ||
968 | /* FIXME: Really for ATA it isn't safe because the device may be | 979 | /* FIXME: Really for ATA it isn't safe because the device may be |
969 | multi-purpose and we want to leave it alone if it was already | 980 | multi-purpose and we want to leave it alone if it was already |
@@ -984,7 +995,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
984 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); | 995 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); |
985 | mask = (1 << 2) | (1 << 0); | 996 | mask = (1 << 2) | (1 << 0); |
986 | if ((tmp8 & mask) != mask) | 997 | if ((tmp8 & mask) != mask) |
987 | legacy_mode = (1 << 3); | 998 | legacy_mode = 1; |
988 | #if defined(CONFIG_NO_ATA_LEGACY) | 999 | #if defined(CONFIG_NO_ATA_LEGACY) |
989 | /* Some platforms with PCI limits cannot address compat | 1000 | /* Some platforms with PCI limits cannot address compat |
990 | port space. In that case we punt if their firmware has | 1001 | port space. In that case we punt if their firmware has |
@@ -998,7 +1009,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
998 | } | 1009 | } |
999 | 1010 | ||
1000 | /* alloc and init host */ | 1011 | /* alloc and init host */ |
1001 | host = ata_host_alloc_pinfo(dev, port, n_ports); | 1012 | host = ata_host_alloc_pinfo(dev, ppi, 2); |
1002 | if (!host) { | 1013 | if (!host) { |
1003 | dev_printk(KERN_ERR, &pdev->dev, | 1014 | dev_printk(KERN_ERR, &pdev->dev, |
1004 | "failed to allocate ATA host\n"); | 1015 | "failed to allocate ATA host\n"); |
@@ -1007,19 +1018,13 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1007 | } | 1018 | } |
1008 | 1019 | ||
1009 | if (!legacy_mode) { | 1020 | if (!legacy_mode) { |
1010 | unsigned int port_mask; | 1021 | rc = ata_pci_init_native_host(host); |
1011 | |||
1012 | port_mask = ATA_PORT_PRIMARY; | ||
1013 | if (n_ports > 1) | ||
1014 | port_mask |= ATA_PORT_SECONDARY; | ||
1015 | |||
1016 | rc = ata_pci_init_native_host(host, port_mask); | ||
1017 | if (rc) | 1022 | if (rc) |
1018 | goto err_out; | 1023 | goto err_out; |
1019 | } else { | 1024 | } else { |
1020 | int was_busy = 0; | 1025 | int was_busy = 0; |
1021 | 1026 | ||
1022 | rc = ata_init_legacy_host(host, &legacy_mode, &was_busy); | 1027 | rc = ata_init_legacy_host(host, &was_busy); |
1023 | if (was_busy) | 1028 | if (was_busy) |
1024 | pcim_pin_device(pdev); | 1029 | pcim_pin_device(pdev); |
1025 | if (rc) | 1030 | if (rc) |
@@ -1040,8 +1045,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1040 | goto err_out; | 1045 | goto err_out; |
1041 | 1046 | ||
1042 | if (!legacy_mode) | 1047 | if (!legacy_mode) |
1043 | rc = devm_request_irq(dev, pdev->irq, | 1048 | rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, |
1044 | port_info[0]->port_ops->irq_handler, | ||
1045 | IRQF_SHARED, DRV_NAME, host); | 1049 | IRQF_SHARED, DRV_NAME, host); |
1046 | else { | 1050 | else { |
1047 | irq_handler_t handler[2] = { host->ops->irq_handler, | 1051 | irq_handler_t handler[2] = { host->ops->irq_handler, |
@@ -1055,7 +1059,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1055 | goto err_out; | 1059 | goto err_out; |
1056 | 1060 | ||
1057 | /* register */ | 1061 | /* register */ |
1058 | rc = ata_host_register(host, port_info[0]->sht); | 1062 | rc = ata_host_register(host, pi->sht); |
1059 | if (rc) | 1063 | if (rc) |
1060 | goto err_out; | 1064 | goto err_out; |
1061 | 1065 | ||
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 48c7531ae690..3c55a5ff74c7 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -518,14 +518,14 @@ static void ali_init_chipset(struct pci_dev *pdev) | |||
518 | 518 | ||
519 | static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 519 | static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
520 | { | 520 | { |
521 | static struct ata_port_info info_early = { | 521 | static const struct ata_port_info info_early = { |
522 | .sht = &ali_sht, | 522 | .sht = &ali_sht, |
523 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 523 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
524 | .pio_mask = 0x1f, | 524 | .pio_mask = 0x1f, |
525 | .port_ops = &ali_early_port_ops | 525 | .port_ops = &ali_early_port_ops |
526 | }; | 526 | }; |
527 | /* Revision 0x20 added DMA */ | 527 | /* Revision 0x20 added DMA */ |
528 | static struct ata_port_info info_20 = { | 528 | static const struct ata_port_info info_20 = { |
529 | .sht = &ali_sht, | 529 | .sht = &ali_sht, |
530 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 530 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
531 | .pio_mask = 0x1f, | 531 | .pio_mask = 0x1f, |
@@ -533,7 +533,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
533 | .port_ops = &ali_20_port_ops | 533 | .port_ops = &ali_20_port_ops |
534 | }; | 534 | }; |
535 | /* Revision 0x20 with support logic added UDMA */ | 535 | /* Revision 0x20 with support logic added UDMA */ |
536 | static struct ata_port_info info_20_udma = { | 536 | static const struct ata_port_info info_20_udma = { |
537 | .sht = &ali_sht, | 537 | .sht = &ali_sht, |
538 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 538 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
539 | .pio_mask = 0x1f, | 539 | .pio_mask = 0x1f, |
@@ -542,7 +542,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
542 | .port_ops = &ali_20_port_ops | 542 | .port_ops = &ali_20_port_ops |
543 | }; | 543 | }; |
544 | /* Revision 0xC2 adds UDMA66 */ | 544 | /* Revision 0xC2 adds UDMA66 */ |
545 | static struct ata_port_info info_c2 = { | 545 | static const struct ata_port_info info_c2 = { |
546 | .sht = &ali_sht, | 546 | .sht = &ali_sht, |
547 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 547 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
548 | .pio_mask = 0x1f, | 548 | .pio_mask = 0x1f, |
@@ -551,7 +551,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
551 | .port_ops = &ali_c2_port_ops | 551 | .port_ops = &ali_c2_port_ops |
552 | }; | 552 | }; |
553 | /* Revision 0xC3 is UDMA100 */ | 553 | /* Revision 0xC3 is UDMA100 */ |
554 | static struct ata_port_info info_c3 = { | 554 | static const struct ata_port_info info_c3 = { |
555 | .sht = &ali_sht, | 555 | .sht = &ali_sht, |
556 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 556 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
557 | .pio_mask = 0x1f, | 557 | .pio_mask = 0x1f, |
@@ -560,7 +560,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
560 | .port_ops = &ali_c2_port_ops | 560 | .port_ops = &ali_c2_port_ops |
561 | }; | 561 | }; |
562 | /* Revision 0xC4 is UDMA133 */ | 562 | /* Revision 0xC4 is UDMA133 */ |
563 | static struct ata_port_info info_c4 = { | 563 | static const struct ata_port_info info_c4 = { |
564 | .sht = &ali_sht, | 564 | .sht = &ali_sht, |
565 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 565 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
566 | .pio_mask = 0x1f, | 566 | .pio_mask = 0x1f, |
@@ -569,7 +569,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
569 | .port_ops = &ali_c2_port_ops | 569 | .port_ops = &ali_c2_port_ops |
570 | }; | 570 | }; |
571 | /* Revision 0xC5 is UDMA133 with LBA48 DMA */ | 571 | /* Revision 0xC5 is UDMA133 with LBA48 DMA */ |
572 | static struct ata_port_info info_c5 = { | 572 | static const struct ata_port_info info_c5 = { |
573 | .sht = &ali_sht, | 573 | .sht = &ali_sht, |
574 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 574 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
575 | .pio_mask = 0x1f, | 575 | .pio_mask = 0x1f, |
@@ -578,7 +578,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
578 | .port_ops = &ali_c5_port_ops | 578 | .port_ops = &ali_c5_port_ops |
579 | }; | 579 | }; |
580 | 580 | ||
581 | static struct ata_port_info *port_info[2]; | 581 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
582 | u8 rev, tmp; | 582 | u8 rev, tmp; |
583 | struct pci_dev *isa_bridge; | 583 | struct pci_dev *isa_bridge; |
584 | 584 | ||
@@ -590,17 +590,17 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
590 | */ | 590 | */ |
591 | 591 | ||
592 | if (rev < 0x20) { | 592 | if (rev < 0x20) { |
593 | port_info[0] = port_info[1] = &info_early; | 593 | ppi[0] = &info_early; |
594 | } else if (rev < 0xC2) { | 594 | } else if (rev < 0xC2) { |
595 | port_info[0] = port_info[1] = &info_20; | 595 | ppi[0] = &info_20; |
596 | } else if (rev == 0xC2) { | 596 | } else if (rev == 0xC2) { |
597 | port_info[0] = port_info[1] = &info_c2; | 597 | ppi[0] = &info_c2; |
598 | } else if (rev == 0xC3) { | 598 | } else if (rev == 0xC3) { |
599 | port_info[0] = port_info[1] = &info_c3; | 599 | ppi[0] = &info_c3; |
600 | } else if (rev == 0xC4) { | 600 | } else if (rev == 0xC4) { |
601 | port_info[0] = port_info[1] = &info_c4; | 601 | ppi[0] = &info_c4; |
602 | } else | 602 | } else |
603 | port_info[0] = port_info[1] = &info_c5; | 603 | ppi[0] = &info_c5; |
604 | 604 | ||
605 | ali_init_chipset(pdev); | 605 | ali_init_chipset(pdev); |
606 | 606 | ||
@@ -609,10 +609,10 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
609 | /* Are we paired with a UDMA capable chip */ | 609 | /* Are we paired with a UDMA capable chip */ |
610 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); | 610 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); |
611 | if ((tmp & 0x1E) == 0x12) | 611 | if ((tmp & 0x1E) == 0x12) |
612 | port_info[0] = port_info[1] = &info_20_udma; | 612 | ppi[0] = &info_20_udma; |
613 | pci_dev_put(isa_bridge); | 613 | pci_dev_put(isa_bridge); |
614 | } | 614 | } |
615 | return ata_pci_init_one(pdev, port_info, 2); | 615 | return ata_pci_init_one(pdev, ppi); |
616 | } | 616 | } |
617 | 617 | ||
618 | #ifdef CONFIG_PM | 618 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 86a26186739c..b439351f1fd3 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -538,7 +538,7 @@ static struct ata_port_operations nv133_port_ops = { | |||
538 | 538 | ||
539 | static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 539 | static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
540 | { | 540 | { |
541 | static struct ata_port_info info[10] = { | 541 | static const struct ata_port_info info[10] = { |
542 | { /* 0: AMD 7401 */ | 542 | { /* 0: AMD 7401 */ |
543 | .sht = &amd_sht, | 543 | .sht = &amd_sht, |
544 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 544 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -620,7 +620,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
620 | .port_ops = &amd100_port_ops | 620 | .port_ops = &amd100_port_ops |
621 | } | 621 | } |
622 | }; | 622 | }; |
623 | static struct ata_port_info *port_info[2]; | 623 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
624 | static int printed_version; | 624 | static int printed_version; |
625 | int type = id->driver_data; | 625 | int type = id->driver_data; |
626 | u8 rev; | 626 | u8 rev; |
@@ -652,9 +652,8 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
652 | ata_pci_clear_simplex(pdev); | 652 | ata_pci_clear_simplex(pdev); |
653 | 653 | ||
654 | /* And fire it up */ | 654 | /* And fire it up */ |
655 | 655 | ppi[0] = &info[type]; | |
656 | port_info[0] = port_info[1] = &info[type]; | 656 | return ata_pci_init_one(pdev, ppi); |
657 | return ata_pci_init_one(pdev, port_info, 2); | ||
658 | } | 657 | } |
659 | 658 | ||
660 | #ifdef CONFIG_PM | 659 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index ef51940c3adb..9861059dd673 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -414,7 +414,7 @@ static const struct ata_port_operations artop6260_ops = { | |||
414 | static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 414 | static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
415 | { | 415 | { |
416 | static int printed_version; | 416 | static int printed_version; |
417 | static struct ata_port_info info_6210 = { | 417 | static const struct ata_port_info info_6210 = { |
418 | .sht = &artop_sht, | 418 | .sht = &artop_sht, |
419 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 419 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
420 | .pio_mask = 0x1f, /* pio0-4 */ | 420 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -422,7 +422,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
422 | .udma_mask = ATA_UDMA2, | 422 | .udma_mask = ATA_UDMA2, |
423 | .port_ops = &artop6210_ops, | 423 | .port_ops = &artop6210_ops, |
424 | }; | 424 | }; |
425 | static struct ata_port_info info_626x = { | 425 | static const struct ata_port_info info_626x = { |
426 | .sht = &artop_sht, | 426 | .sht = &artop_sht, |
427 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 427 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
428 | .pio_mask = 0x1f, /* pio0-4 */ | 428 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -430,7 +430,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
430 | .udma_mask = ATA_UDMA4, | 430 | .udma_mask = ATA_UDMA4, |
431 | .port_ops = &artop6260_ops, | 431 | .port_ops = &artop6260_ops, |
432 | }; | 432 | }; |
433 | static struct ata_port_info info_626x_fast = { | 433 | static const struct ata_port_info info_626x_fast = { |
434 | .sht = &artop_sht, | 434 | .sht = &artop_sht, |
435 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 435 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
436 | .pio_mask = 0x1f, /* pio0-4 */ | 436 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -438,32 +438,30 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
438 | .udma_mask = ATA_UDMA5, | 438 | .udma_mask = ATA_UDMA5, |
439 | .port_ops = &artop6260_ops, | 439 | .port_ops = &artop6260_ops, |
440 | }; | 440 | }; |
441 | struct ata_port_info *port_info[2]; | 441 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
442 | struct ata_port_info *info = NULL; | ||
443 | int ports = 2; | ||
444 | 442 | ||
445 | if (!printed_version++) | 443 | if (!printed_version++) |
446 | dev_printk(KERN_DEBUG, &pdev->dev, | 444 | dev_printk(KERN_DEBUG, &pdev->dev, |
447 | "version " DRV_VERSION "\n"); | 445 | "version " DRV_VERSION "\n"); |
448 | 446 | ||
449 | if (id->driver_data == 0) { /* 6210 variant */ | 447 | if (id->driver_data == 0) { /* 6210 variant */ |
450 | info = &info_6210; | 448 | ppi[0] = &info_6210; |
449 | ppi[1] = &ata_dummy_port_info; | ||
451 | /* BIOS may have left us in UDMA, clear it before libata probe */ | 450 | /* BIOS may have left us in UDMA, clear it before libata probe */ |
452 | pci_write_config_byte(pdev, 0x54, 0); | 451 | pci_write_config_byte(pdev, 0x54, 0); |
453 | /* For the moment (also lacks dsc) */ | 452 | /* For the moment (also lacks dsc) */ |
454 | printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n"); | 453 | printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n"); |
455 | printk(KERN_WARNING "Secondary ATA ports will not be activated.\n"); | 454 | printk(KERN_WARNING "Secondary ATA ports will not be activated.\n"); |
456 | ports = 1; | ||
457 | } | 455 | } |
458 | else if (id->driver_data == 1) /* 6260 */ | 456 | else if (id->driver_data == 1) /* 6260 */ |
459 | info = &info_626x; | 457 | ppi[0] = &info_626x; |
460 | else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ | 458 | else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ |
461 | unsigned long io = pci_resource_start(pdev, 4); | 459 | unsigned long io = pci_resource_start(pdev, 4); |
462 | u8 reg; | 460 | u8 reg; |
463 | 461 | ||
464 | info = &info_626x; | 462 | ppi[0] = &info_626x; |
465 | if (inb(io) & 0x10) | 463 | if (inb(io) & 0x10) |
466 | info = &info_626x_fast; | 464 | ppi[0] = &info_626x_fast; |
467 | /* Mac systems come up with some registers not set as we | 465 | /* Mac systems come up with some registers not set as we |
468 | will need them */ | 466 | will need them */ |
469 | 467 | ||
@@ -484,10 +482,9 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
484 | 482 | ||
485 | } | 483 | } |
486 | 484 | ||
487 | BUG_ON(info == NULL); | 485 | BUG_ON(ppi[0] == NULL); |
488 | 486 | ||
489 | port_info[0] = port_info[1] = info; | 487 | return ata_pci_init_one(pdev, ppi); |
490 | return ata_pci_init_one(pdev, port_info, ports); | ||
491 | } | 488 | } |
492 | 489 | ||
493 | static const struct pci_device_id artop_pci_tbl[] = { | 490 | static const struct pci_device_id artop_pci_tbl[] = { |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 3c2264dbdd67..844914681a2a 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -268,7 +268,7 @@ static struct ata_port_operations atiixp_port_ops = { | |||
268 | 268 | ||
269 | static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 269 | static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
270 | { | 270 | { |
271 | static struct ata_port_info info = { | 271 | static const struct ata_port_info info = { |
272 | .sht = &atiixp_sht, | 272 | .sht = &atiixp_sht, |
273 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 273 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
274 | .pio_mask = 0x1f, | 274 | .pio_mask = 0x1f, |
@@ -276,8 +276,8 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
276 | .udma_mask = 0x3F, | 276 | .udma_mask = 0x3F, |
277 | .port_ops = &atiixp_port_ops | 277 | .port_ops = &atiixp_port_ops |
278 | }; | 278 | }; |
279 | static struct ata_port_info *port_info[2] = { &info, &info }; | 279 | const struct ata_port_info *ppi[] = { &info, NULL }; |
280 | return ata_pci_init_one(dev, port_info, 2); | 280 | return ata_pci_init_one(dev, ppi); |
281 | } | 281 | } |
282 | 282 | ||
283 | static const struct pci_device_id atiixp[] = { | 283 | static const struct pci_device_id atiixp[] = { |
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 987dec935b5c..ed00fa9d53be 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c | |||
@@ -249,17 +249,16 @@ static void cmd640_hardware_init(struct pci_dev *pdev) | |||
249 | 249 | ||
250 | static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 250 | static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
251 | { | 251 | { |
252 | static struct ata_port_info info = { | 252 | static const struct ata_port_info info = { |
253 | .sht = &cmd640_sht, | 253 | .sht = &cmd640_sht, |
254 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 254 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
255 | .pio_mask = 0x1f, | 255 | .pio_mask = 0x1f, |
256 | .port_ops = &cmd640_port_ops | 256 | .port_ops = &cmd640_port_ops |
257 | }; | 257 | }; |
258 | 258 | const struct ata_port_info *ppi[] = { &info, NULL }; | |
259 | static struct ata_port_info *port_info[2] = { &info, &info }; | ||
260 | 259 | ||
261 | cmd640_hardware_init(pdev); | 260 | cmd640_hardware_init(pdev); |
262 | return ata_pci_init_one(pdev, port_info, 2); | 261 | return ata_pci_init_one(pdev, ppi); |
263 | } | 262 | } |
264 | 263 | ||
265 | static int cmd640_reinit_one(struct pci_dev *pdev) | 264 | static int cmd640_reinit_one(struct pci_dev *pdev) |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 3e02c6a3ba9c..2a79b335cfcc 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -377,7 +377,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
377 | { | 377 | { |
378 | u32 class_rev; | 378 | u32 class_rev; |
379 | 379 | ||
380 | static struct ata_port_info cmd_info[6] = { | 380 | static const struct ata_port_info cmd_info[6] = { |
381 | { /* CMD 643 - no UDMA */ | 381 | { /* CMD 643 - no UDMA */ |
382 | .sht = &cmd64x_sht, | 382 | .sht = &cmd64x_sht, |
383 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 383 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -424,11 +424,9 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
424 | .port_ops = &cmd648_port_ops | 424 | .port_ops = &cmd648_port_ops |
425 | } | 425 | } |
426 | }; | 426 | }; |
427 | static struct ata_port_info *port_info[2], *info; | 427 | const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL }; |
428 | u8 mrdmode; | 428 | u8 mrdmode; |
429 | 429 | ||
430 | info = &cmd_info[id->driver_data]; | ||
431 | |||
432 | pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); | 430 | pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); |
433 | class_rev &= 0xFF; | 431 | class_rev &= 0xFF; |
434 | 432 | ||
@@ -438,10 +436,10 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
438 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { | 436 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { |
439 | /* Does UDMA work ? */ | 437 | /* Does UDMA work ? */ |
440 | if (class_rev > 4) | 438 | if (class_rev > 4) |
441 | info = &cmd_info[2]; | 439 | ppi[0] = &cmd_info[2]; |
442 | /* Early rev with other problems ? */ | 440 | /* Early rev with other problems ? */ |
443 | else if (class_rev == 1) | 441 | else if (class_rev == 1) |
444 | info = &cmd_info[3]; | 442 | ppi[0] = &cmd_info[3]; |
445 | } | 443 | } |
446 | 444 | ||
447 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); | 445 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); |
@@ -457,8 +455,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
457 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | 455 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); |
458 | #endif | 456 | #endif |
459 | 457 | ||
460 | port_info[0] = port_info[1] = info; | 458 | return ata_pci_init_one(pdev, ppi); |
461 | return ata_pci_init_one(pdev, port_info, 2); | ||
462 | } | 459 | } |
463 | 460 | ||
464 | #ifdef CONFIG_PM | 461 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 637d8b302e3e..1b67923d7a4e 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -335,7 +335,7 @@ fail_put: | |||
335 | 335 | ||
336 | static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 336 | static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
337 | { | 337 | { |
338 | static struct ata_port_info info = { | 338 | static const struct ata_port_info info = { |
339 | .sht = &cs5530_sht, | 339 | .sht = &cs5530_sht, |
340 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 340 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
341 | .pio_mask = 0x1f, | 341 | .pio_mask = 0x1f, |
@@ -344,23 +344,23 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
344 | .port_ops = &cs5530_port_ops | 344 | .port_ops = &cs5530_port_ops |
345 | }; | 345 | }; |
346 | /* The docking connector doesn't do UDMA, and it seems not MWDMA */ | 346 | /* The docking connector doesn't do UDMA, and it seems not MWDMA */ |
347 | static struct ata_port_info info_palmax_secondary = { | 347 | static const struct ata_port_info info_palmax_secondary = { |
348 | .sht = &cs5530_sht, | 348 | .sht = &cs5530_sht, |
349 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 349 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
350 | .pio_mask = 0x1f, | 350 | .pio_mask = 0x1f, |
351 | .port_ops = &cs5530_port_ops | 351 | .port_ops = &cs5530_port_ops |
352 | }; | 352 | }; |
353 | static struct ata_port_info *port_info[2] = { &info, &info }; | 353 | const struct ata_port_info *ppi[] = { &info, NULL }; |
354 | 354 | ||
355 | /* Chip initialisation */ | 355 | /* Chip initialisation */ |
356 | if (cs5530_init_chip()) | 356 | if (cs5530_init_chip()) |
357 | return -ENODEV; | 357 | return -ENODEV; |
358 | 358 | ||
359 | if (cs5530_is_palmax()) | 359 | if (cs5530_is_palmax()) |
360 | port_info[1] = &info_palmax_secondary; | 360 | ppi[1] = &info_palmax_secondary; |
361 | 361 | ||
362 | /* Now kick off ATA set up */ | 362 | /* Now kick off ATA set up */ |
363 | return ata_pci_init_one(pdev, port_info, 2); | 363 | return ata_pci_init_one(pdev, ppi); |
364 | } | 364 | } |
365 | 365 | ||
366 | #ifdef CONFIG_PM | 366 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index 683885a47b6d..f37d4cd812a1 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -223,7 +223,7 @@ static struct ata_port_operations cs5535_port_ops = { | |||
223 | 223 | ||
224 | static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 224 | static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
225 | { | 225 | { |
226 | static struct ata_port_info info = { | 226 | static const struct ata_port_info info = { |
227 | .sht = &cs5535_sht, | 227 | .sht = &cs5535_sht, |
228 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 228 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
229 | .pio_mask = 0x1f, | 229 | .pio_mask = 0x1f, |
@@ -231,7 +231,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
231 | .udma_mask = 0x1f, | 231 | .udma_mask = 0x1f, |
232 | .port_ops = &cs5535_port_ops | 232 | .port_ops = &cs5535_port_ops |
233 | }; | 233 | }; |
234 | struct ata_port_info *ports[1] = { &info }; | 234 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
235 | 235 | ||
236 | u32 timings, dummy; | 236 | u32 timings, dummy; |
237 | 237 | ||
@@ -243,7 +243,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
243 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); | 243 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); |
244 | if (CS5535_BAD_PIO(timings)) | 244 | if (CS5535_BAD_PIO(timings)) |
245 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); | 245 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); |
246 | return ata_pci_init_one(dev, ports, 1); | 246 | return ata_pci_init_one(dev, ppi); |
247 | } | 247 | } |
248 | 248 | ||
249 | static const struct pci_device_id cs5535[] = { | 249 | static const struct pci_device_id cs5535[] = { |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 30e5c543bcb0..27b9f29c01e3 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -165,14 +165,14 @@ static struct ata_port_operations cy82c693_port_ops = { | |||
165 | 165 | ||
166 | static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 166 | static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
167 | { | 167 | { |
168 | static struct ata_port_info info = { | 168 | static const struct ata_port_info info = { |
169 | .sht = &cy82c693_sht, | 169 | .sht = &cy82c693_sht, |
170 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 170 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
171 | .pio_mask = 0x1f, | 171 | .pio_mask = 0x1f, |
172 | .mwdma_mask = 0x07, | 172 | .mwdma_mask = 0x07, |
173 | .port_ops = &cy82c693_port_ops | 173 | .port_ops = &cy82c693_port_ops |
174 | }; | 174 | }; |
175 | static struct ata_port_info *port_info[1] = { &info }; | 175 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
176 | 176 | ||
177 | /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. | 177 | /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. |
178 | For the moment we don't handle the secondary. FIXME */ | 178 | For the moment we don't handle the secondary. FIXME */ |
@@ -180,7 +180,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i | |||
180 | if (PCI_FUNC(pdev->devfn) != 1) | 180 | if (PCI_FUNC(pdev->devfn) != 1) |
181 | return -ENODEV; | 181 | return -ENODEV; |
182 | 182 | ||
183 | return ata_pci_init_one(pdev, port_info, 1); | 183 | return ata_pci_init_one(pdev, ppi); |
184 | } | 184 | } |
185 | 185 | ||
186 | static const struct pci_device_id cy82c693[] = { | 186 | static const struct pci_device_id cy82c693[] = { |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index 23e929f0cd3f..079248a9b460 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -301,7 +301,7 @@ static const struct ata_port_operations efar_ops = { | |||
301 | static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 301 | static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
302 | { | 302 | { |
303 | static int printed_version; | 303 | static int printed_version; |
304 | static struct ata_port_info info = { | 304 | static const struct ata_port_info info = { |
305 | .sht = &efar_sht, | 305 | .sht = &efar_sht, |
306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
307 | .pio_mask = 0x1f, /* pio0-4 */ | 307 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -309,13 +309,13 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
309 | .udma_mask = 0x0f, /* UDMA 66 */ | 309 | .udma_mask = 0x0f, /* UDMA 66 */ |
310 | .port_ops = &efar_ops, | 310 | .port_ops = &efar_ops, |
311 | }; | 311 | }; |
312 | static struct ata_port_info *port_info[2] = { &info, &info }; | 312 | const struct ata_port_info *ppi[] = { &info, NULL }; |
313 | 313 | ||
314 | if (!printed_version++) | 314 | if (!printed_version++) |
315 | dev_printk(KERN_DEBUG, &pdev->dev, | 315 | dev_printk(KERN_DEBUG, &pdev->dev, |
316 | "version " DRV_VERSION "\n"); | 316 | "version " DRV_VERSION "\n"); |
317 | 317 | ||
318 | return ata_pci_init_one(pdev, port_info, 2); | 318 | return ata_pci_init_one(pdev, ppi); |
319 | } | 319 | } |
320 | 320 | ||
321 | static const struct pci_device_id efar_pci_tbl[] = { | 321 | static const struct pci_device_id efar_pci_tbl[] = { |
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index cb965f41d093..c6c8a8bb06d0 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -417,7 +417,7 @@ static void hpt36x_init_chipset(struct pci_dev *dev) | |||
417 | 417 | ||
418 | static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 418 | static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
419 | { | 419 | { |
420 | static struct ata_port_info info_hpt366 = { | 420 | static const struct ata_port_info info_hpt366 = { |
421 | .sht = &hpt36x_sht, | 421 | .sht = &hpt36x_sht, |
422 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 422 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
423 | .pio_mask = 0x1f, | 423 | .pio_mask = 0x1f, |
@@ -425,7 +425,8 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
425 | .udma_mask = 0x1f, | 425 | .udma_mask = 0x1f, |
426 | .port_ops = &hpt366_port_ops | 426 | .port_ops = &hpt366_port_ops |
427 | }; | 427 | }; |
428 | struct ata_port_info *port_info[2] = {&info_hpt366, &info_hpt366}; | 428 | struct ata_port_info info = info_hpt366; |
429 | const struct ata_port_info *ppi[] = { &info, NULL }; | ||
429 | 430 | ||
430 | u32 class_rev; | 431 | u32 class_rev; |
431 | u32 reg1; | 432 | u32 reg1; |
@@ -446,17 +447,17 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
446 | /* info_hpt366 is safe against re-entry so we can scribble on it */ | 447 | /* info_hpt366 is safe against re-entry so we can scribble on it */ |
447 | switch((reg1 & 0x700) >> 8) { | 448 | switch((reg1 & 0x700) >> 8) { |
448 | case 5: | 449 | case 5: |
449 | info_hpt366.private_data = &hpt366_40; | 450 | info.private_data = &hpt366_40; |
450 | break; | 451 | break; |
451 | case 9: | 452 | case 9: |
452 | info_hpt366.private_data = &hpt366_25; | 453 | info.private_data = &hpt366_25; |
453 | break; | 454 | break; |
454 | default: | 455 | default: |
455 | info_hpt366.private_data = &hpt366_33; | 456 | info.private_data = &hpt366_33; |
456 | break; | 457 | break; |
457 | } | 458 | } |
458 | /* Now kick off ATA set up */ | 459 | /* Now kick off ATA set up */ |
459 | return ata_pci_init_one(dev, port_info, 2); | 460 | return ata_pci_init_one(dev, ppi); |
460 | } | 461 | } |
461 | 462 | ||
462 | #ifdef CONFIG_PM | 463 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 1614e8c822a4..5a0a410654e2 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -887,7 +887,7 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) | |||
887 | static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 887 | static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
888 | { | 888 | { |
889 | /* HPT370 - UDMA100 */ | 889 | /* HPT370 - UDMA100 */ |
890 | static struct ata_port_info info_hpt370 = { | 890 | static const struct ata_port_info info_hpt370 = { |
891 | .sht = &hpt37x_sht, | 891 | .sht = &hpt37x_sht, |
892 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 892 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
893 | .pio_mask = 0x1f, | 893 | .pio_mask = 0x1f, |
@@ -896,7 +896,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
896 | .port_ops = &hpt370_port_ops | 896 | .port_ops = &hpt370_port_ops |
897 | }; | 897 | }; |
898 | /* HPT370A - UDMA100 */ | 898 | /* HPT370A - UDMA100 */ |
899 | static struct ata_port_info info_hpt370a = { | 899 | static const struct ata_port_info info_hpt370a = { |
900 | .sht = &hpt37x_sht, | 900 | .sht = &hpt37x_sht, |
901 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 901 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
902 | .pio_mask = 0x1f, | 902 | .pio_mask = 0x1f, |
@@ -905,7 +905,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
905 | .port_ops = &hpt370a_port_ops | 905 | .port_ops = &hpt370a_port_ops |
906 | }; | 906 | }; |
907 | /* HPT370 - UDMA100 */ | 907 | /* HPT370 - UDMA100 */ |
908 | static struct ata_port_info info_hpt370_33 = { | 908 | static const struct ata_port_info info_hpt370_33 = { |
909 | .sht = &hpt37x_sht, | 909 | .sht = &hpt37x_sht, |
910 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 910 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
911 | .pio_mask = 0x1f, | 911 | .pio_mask = 0x1f, |
@@ -914,7 +914,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
914 | .port_ops = &hpt370_port_ops | 914 | .port_ops = &hpt370_port_ops |
915 | }; | 915 | }; |
916 | /* HPT370A - UDMA100 */ | 916 | /* HPT370A - UDMA100 */ |
917 | static struct ata_port_info info_hpt370a_33 = { | 917 | static const struct ata_port_info info_hpt370a_33 = { |
918 | .sht = &hpt37x_sht, | 918 | .sht = &hpt37x_sht, |
919 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 919 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
920 | .pio_mask = 0x1f, | 920 | .pio_mask = 0x1f, |
@@ -923,7 +923,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
923 | .port_ops = &hpt370a_port_ops | 923 | .port_ops = &hpt370a_port_ops |
924 | }; | 924 | }; |
925 | /* HPT371, 372 and friends - UDMA133 */ | 925 | /* HPT371, 372 and friends - UDMA133 */ |
926 | static struct ata_port_info info_hpt372 = { | 926 | static const struct ata_port_info info_hpt372 = { |
927 | .sht = &hpt37x_sht, | 927 | .sht = &hpt37x_sht, |
928 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 928 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
929 | .pio_mask = 0x1f, | 929 | .pio_mask = 0x1f, |
@@ -932,7 +932,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
932 | .port_ops = &hpt372_port_ops | 932 | .port_ops = &hpt372_port_ops |
933 | }; | 933 | }; |
934 | /* HPT371, 372 and friends - UDMA100 at 50MHz clock */ | 934 | /* HPT371, 372 and friends - UDMA100 at 50MHz clock */ |
935 | static struct ata_port_info info_hpt372_50 = { | 935 | static const struct ata_port_info info_hpt372_50 = { |
936 | .sht = &hpt37x_sht, | 936 | .sht = &hpt37x_sht, |
937 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 937 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
938 | .pio_mask = 0x1f, | 938 | .pio_mask = 0x1f, |
@@ -941,7 +941,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
941 | .port_ops = &hpt372_port_ops | 941 | .port_ops = &hpt372_port_ops |
942 | }; | 942 | }; |
943 | /* HPT374 - UDMA133 */ | 943 | /* HPT374 - UDMA133 */ |
944 | static struct ata_port_info info_hpt374 = { | 944 | static const struct ata_port_info info_hpt374 = { |
945 | .sht = &hpt37x_sht, | 945 | .sht = &hpt37x_sht, |
946 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 946 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
947 | .pio_mask = 0x1f, | 947 | .pio_mask = 0x1f, |
@@ -951,9 +951,10 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
951 | }; | 951 | }; |
952 | 952 | ||
953 | static const int MHz[4] = { 33, 40, 50, 66 }; | 953 | static const int MHz[4] = { 33, 40, 50, 66 }; |
954 | 954 | const struct ata_port_info *port; | |
955 | struct ata_port_info *port_info[2]; | 955 | void *private_data = NULL; |
956 | struct ata_port_info *port; | 956 | struct ata_port_info port_info; |
957 | const struct ata_port_info *ppi[] = { &port_info, NULL }; | ||
957 | 958 | ||
958 | u8 irqmask; | 959 | u8 irqmask; |
959 | u32 class_rev; | 960 | u32 class_rev; |
@@ -1124,13 +1125,13 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1124 | return -ENODEV; | 1125 | return -ENODEV; |
1125 | } | 1126 | } |
1126 | if (clock_slot == 3) | 1127 | if (clock_slot == 3) |
1127 | port->private_data = (void *)hpt37x_timings_66; | 1128 | private_data = (void *)hpt37x_timings_66; |
1128 | else | 1129 | else |
1129 | port->private_data = (void *)hpt37x_timings_50; | 1130 | private_data = (void *)hpt37x_timings_50; |
1130 | 1131 | ||
1131 | printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); | 1132 | printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); |
1132 | } else { | 1133 | } else { |
1133 | port->private_data = (void *)chip_table->clocks[clock_slot]; | 1134 | private_data = (void *)chip_table->clocks[clock_slot]; |
1134 | /* | 1135 | /* |
1135 | * Perform a final fixup. Note that we will have used the | 1136 | * Perform a final fixup. Note that we will have used the |
1136 | * DPLL on the HPT372 which means we don't have to worry | 1137 | * DPLL on the HPT372 which means we don't have to worry |
@@ -1144,9 +1145,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1144 | printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); | 1145 | printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); |
1145 | } | 1146 | } |
1146 | 1147 | ||
1147 | port_info[0] = port_info[1] = port; | ||
1148 | /* Now kick off ATA set up */ | 1148 | /* Now kick off ATA set up */ |
1149 | return ata_pci_init_one(dev, port_info, 2); | 1149 | port_info = *port; |
1150 | port_info.private_data = private_data; | ||
1151 | |||
1152 | return ata_pci_init_one(dev, ppi); | ||
1150 | } | 1153 | } |
1151 | 1154 | ||
1152 | static const struct pci_device_id hpt37x[] = { | 1155 | static const struct pci_device_id hpt37x[] = { |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index ea1037d67860..f25154aed75d 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -488,7 +488,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) | |||
488 | static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 488 | static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
489 | { | 489 | { |
490 | /* HPT372N and friends - UDMA133 */ | 490 | /* HPT372N and friends - UDMA133 */ |
491 | static struct ata_port_info info = { | 491 | static const struct ata_port_info info = { |
492 | .sht = &hpt3x2n_sht, | 492 | .sht = &hpt3x2n_sht, |
493 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 493 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
494 | .pio_mask = 0x1f, | 494 | .pio_mask = 0x1f, |
@@ -496,8 +496,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
496 | .udma_mask = 0x7f, | 496 | .udma_mask = 0x7f, |
497 | .port_ops = &hpt3x2n_port_ops | 497 | .port_ops = &hpt3x2n_port_ops |
498 | }; | 498 | }; |
499 | struct ata_port_info *port_info[2]; | 499 | struct ata_port_info port = info; |
500 | struct ata_port_info *port = &info; | 500 | const struct ata_port_info *ppi[] = { &port, NULL }; |
501 | 501 | ||
502 | u8 irqmask; | 502 | u8 irqmask; |
503 | u32 class_rev; | 503 | u32 class_rev; |
@@ -585,9 +585,9 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
585 | 585 | ||
586 | /* Set our private data up. We only need a few flags so we use | 586 | /* Set our private data up. We only need a few flags so we use |
587 | it directly */ | 587 | it directly */ |
588 | port->private_data = NULL; | 588 | port.private_data = NULL; |
589 | if (pci_mhz > 60) { | 589 | if (pci_mhz > 60) { |
590 | port->private_data = (void *)PCI66; | 590 | port.private_data = (void *)PCI66; |
591 | /* | 591 | /* |
592 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in | 592 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in |
593 | * the MISC. register to stretch the UltraDMA Tss timing. | 593 | * the MISC. register to stretch the UltraDMA Tss timing. |
@@ -598,8 +598,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
598 | } | 598 | } |
599 | 599 | ||
600 | /* Now kick off ATA set up */ | 600 | /* Now kick off ATA set up */ |
601 | port_info[0] = port_info[1] = port; | 601 | return ata_pci_init_one(dev, ppi); |
602 | return ata_pci_init_one(dev, port_info, 2); | ||
603 | } | 602 | } |
604 | 603 | ||
605 | static const struct pci_device_id hpt3x2n[] = { | 604 | static const struct pci_device_id hpt3x2n[] = { |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index 84c636b9beac..bbabe7902fbb 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -171,7 +171,7 @@ static void hpt3x3_init_chipset(struct pci_dev *dev) | |||
171 | 171 | ||
172 | static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 172 | static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
173 | { | 173 | { |
174 | static struct ata_port_info info = { | 174 | static const struct ata_port_info info = { |
175 | .sht = &hpt3x3_sht, | 175 | .sht = &hpt3x3_sht, |
176 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 176 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
177 | .pio_mask = 0x1f, | 177 | .pio_mask = 0x1f, |
@@ -179,11 +179,11 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
179 | .udma_mask = 0x07, | 179 | .udma_mask = 0x07, |
180 | .port_ops = &hpt3x3_port_ops | 180 | .port_ops = &hpt3x3_port_ops |
181 | }; | 181 | }; |
182 | static struct ata_port_info *port_info[2] = { &info, &info }; | 182 | const struct ata_port_info *ppi[] = { &info, NULL }; |
183 | 183 | ||
184 | hpt3x3_init_chipset(dev); | 184 | hpt3x3_init_chipset(dev); |
185 | /* Now kick off ATA set up */ | 185 | /* Now kick off ATA set up */ |
186 | return ata_pci_init_one(dev, port_info, 2); | 186 | return ata_pci_init_one(dev, ppi); |
187 | } | 187 | } |
188 | 188 | ||
189 | #ifdef CONFIG_PM | 189 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index bf3aaa205edc..a769952646e1 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -311,7 +311,7 @@ static const struct ata_port_operations it8213_ops = { | |||
311 | static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 311 | static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
312 | { | 312 | { |
313 | static int printed_version; | 313 | static int printed_version; |
314 | static struct ata_port_info info = { | 314 | static const struct ata_port_info info = { |
315 | .sht = &it8213_sht, | 315 | .sht = &it8213_sht, |
316 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 316 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
317 | .pio_mask = 0x1f, /* pio0-4 */ | 317 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -319,14 +319,14 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
319 | .udma_mask = 0x1f, /* UDMA 100 */ | 319 | .udma_mask = 0x1f, /* UDMA 100 */ |
320 | .port_ops = &it8213_ops, | 320 | .port_ops = &it8213_ops, |
321 | }; | 321 | }; |
322 | static struct ata_port_info *port_info[2] = { &info, &info }; | 322 | /* Current IT8213 stuff is single port */ |
323 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; | ||
323 | 324 | ||
324 | if (!printed_version++) | 325 | if (!printed_version++) |
325 | dev_printk(KERN_DEBUG, &pdev->dev, | 326 | dev_printk(KERN_DEBUG, &pdev->dev, |
326 | "version " DRV_VERSION "\n"); | 327 | "version " DRV_VERSION "\n"); |
327 | 328 | ||
328 | /* Current IT8213 stuff is single port */ | 329 | return ata_pci_init_one(pdev, ppi); |
329 | return ata_pci_init_one(pdev, port_info, 1); | ||
330 | } | 330 | } |
331 | 331 | ||
332 | static const struct pci_device_id it8213_pci_tbl[] = { | 332 | static const struct pci_device_id it8213_pci_tbl[] = { |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 8e565a5f2c8d..ff9a6fd36657 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -718,14 +718,14 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
718 | { | 718 | { |
719 | u8 conf; | 719 | u8 conf; |
720 | 720 | ||
721 | static struct ata_port_info info_smart = { | 721 | static const struct ata_port_info info_smart = { |
722 | .sht = &it821x_sht, | 722 | .sht = &it821x_sht, |
723 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 723 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
724 | .pio_mask = 0x1f, | 724 | .pio_mask = 0x1f, |
725 | .mwdma_mask = 0x07, | 725 | .mwdma_mask = 0x07, |
726 | .port_ops = &it821x_smart_port_ops | 726 | .port_ops = &it821x_smart_port_ops |
727 | }; | 727 | }; |
728 | static struct ata_port_info info_passthru = { | 728 | static const struct ata_port_info info_passthru = { |
729 | .sht = &it821x_sht, | 729 | .sht = &it821x_sht, |
730 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 730 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
731 | .pio_mask = 0x1f, | 731 | .pio_mask = 0x1f, |
@@ -733,8 +733,8 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
733 | .udma_mask = 0x7f, | 733 | .udma_mask = 0x7f, |
734 | .port_ops = &it821x_passthru_port_ops | 734 | .port_ops = &it821x_passthru_port_ops |
735 | }; | 735 | }; |
736 | static struct ata_port_info *port_info[2]; | ||
737 | 736 | ||
737 | const struct ata_port_info *ppi[] = { NULL, NULL }; | ||
738 | static char *mode[2] = { "pass through", "smart" }; | 738 | static char *mode[2] = { "pass through", "smart" }; |
739 | 739 | ||
740 | /* Force the card into bypass mode if so requested */ | 740 | /* Force the card into bypass mode if so requested */ |
@@ -747,11 +747,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
747 | 747 | ||
748 | printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); | 748 | printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); |
749 | if (conf == 0) | 749 | if (conf == 0) |
750 | port_info[0] = port_info[1] = &info_passthru; | 750 | ppi[0] = &info_passthru; |
751 | else | 751 | else |
752 | port_info[0] = port_info[1] = &info_smart; | 752 | ppi[0] = &info_smart; |
753 | 753 | ||
754 | return ata_pci_init_one(pdev, port_info, 2); | 754 | return ata_pci_init_one(pdev, ppi); |
755 | } | 755 | } |
756 | 756 | ||
757 | #ifdef CONFIG_PM | 757 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 1aa7bc2fda54..8d799e87f752 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -191,7 +191,7 @@ static const struct ata_port_operations jmicron_ops = { | |||
191 | 191 | ||
192 | static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 192 | static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
193 | { | 193 | { |
194 | static struct ata_port_info info = { | 194 | static const struct ata_port_info info = { |
195 | .sht = &jmicron_sht, | 195 | .sht = &jmicron_sht, |
196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
197 | 197 | ||
@@ -201,9 +201,9 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
201 | 201 | ||
202 | .port_ops = &jmicron_ops, | 202 | .port_ops = &jmicron_ops, |
203 | }; | 203 | }; |
204 | struct ata_port_info *port_info[2] = { &info, &info }; | 204 | const struct ata_port_info *ppi[] = { &info, NULL }; |
205 | 205 | ||
206 | return ata_pci_init_one(pdev, port_info, 2); | 206 | return ata_pci_init_one(pdev, ppi); |
207 | } | 207 | } |
208 | 208 | ||
209 | static const struct pci_device_id jmicron_pci_tbl[] = { | 209 | static const struct pci_device_id jmicron_pci_tbl[] = { |
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 2745e23cac43..edbfe0dbbf78 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -161,7 +161,7 @@ static const struct ata_port_operations marvell_ops = { | |||
161 | 161 | ||
162 | static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 162 | static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
163 | { | 163 | { |
164 | static struct ata_port_info info = { | 164 | static const struct ata_port_info info = { |
165 | .sht = &marvell_sht, | 165 | .sht = &marvell_sht, |
166 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 166 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
167 | 167 | ||
@@ -171,7 +171,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
171 | 171 | ||
172 | .port_ops = &marvell_ops, | 172 | .port_ops = &marvell_ops, |
173 | }; | 173 | }; |
174 | static struct ata_port_info info_sata = { | 174 | static const struct ata_port_info info_sata = { |
175 | .sht = &marvell_sht, | 175 | .sht = &marvell_sht, |
176 | /* Slave possible as its magically mapped not real */ | 176 | /* Slave possible as its magically mapped not real */ |
177 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 177 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -182,13 +182,12 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
182 | 182 | ||
183 | .port_ops = &marvell_ops, | 183 | .port_ops = &marvell_ops, |
184 | }; | 184 | }; |
185 | struct ata_port_info *port_info[2] = { &info, &info_sata }; | 185 | const struct ata_port_info *ppi[] = { &info, &info_sata }; |
186 | int n_port = 2; | ||
187 | 186 | ||
188 | if (pdev->device == 0x6101) | 187 | if (pdev->device == 0x6101) |
189 | n_port = 1; | 188 | ppi[1] = &ata_dummy_port_info; |
190 | 189 | ||
191 | return ata_pci_init_one(pdev, port_info, n_port); | 190 | return ata_pci_init_one(pdev, ppi); |
192 | } | 191 | } |
193 | 192 | ||
194 | static const struct pci_device_id marvell_pci_tbl[] = { | 193 | static const struct pci_device_id marvell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index f15eb34fb1fc..81f563458666 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -92,7 +92,7 @@ static const struct ata_port_operations netcell_ops = { | |||
92 | static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 92 | static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
93 | { | 93 | { |
94 | static int printed_version; | 94 | static int printed_version; |
95 | static struct ata_port_info info = { | 95 | static const struct ata_port_info info = { |
96 | .sht = &netcell_sht, | 96 | .sht = &netcell_sht, |
97 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 97 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
98 | /* Actually we don't really care about these as the | 98 | /* Actually we don't really care about these as the |
@@ -102,7 +102,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
102 | .udma_mask = 0x3f, /* UDMA 133 */ | 102 | .udma_mask = 0x3f, /* UDMA 133 */ |
103 | .port_ops = &netcell_ops, | 103 | .port_ops = &netcell_ops, |
104 | }; | 104 | }; |
105 | static struct ata_port_info *port_info[2] = { &info, &info }; | 105 | const struct ata_port_info *port_info[] = { &info, NULL }; |
106 | 106 | ||
107 | if (!printed_version++) | 107 | if (!printed_version++) |
108 | dev_printk(KERN_DEBUG, &pdev->dev, | 108 | dev_printk(KERN_DEBUG, &pdev->dev, |
@@ -112,7 +112,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
112 | ata_pci_clear_simplex(pdev); | 112 | ata_pci_clear_simplex(pdev); |
113 | 113 | ||
114 | /* And let the library code do the work */ | 114 | /* And let the library code do the work */ |
115 | return ata_pci_init_one(pdev, port_info, 2); | 115 | return ata_pci_init_one(pdev, port_info); |
116 | } | 116 | } |
117 | 117 | ||
118 | static const struct pci_device_id netcell_pci_tbl[] = { | 118 | static const struct pci_device_id netcell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index d5eb42bdae9a..ea70ec744879 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -191,14 +191,14 @@ static struct ata_port_operations ns87410_port_ops = { | |||
191 | 191 | ||
192 | static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 192 | static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
193 | { | 193 | { |
194 | static struct ata_port_info info = { | 194 | static const struct ata_port_info info = { |
195 | .sht = &ns87410_sht, | 195 | .sht = &ns87410_sht, |
196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
197 | .pio_mask = 0x0F, | 197 | .pio_mask = 0x0F, |
198 | .port_ops = &ns87410_port_ops | 198 | .port_ops = &ns87410_port_ops |
199 | }; | 199 | }; |
200 | static struct ata_port_info *port_info[2] = {&info, &info}; | 200 | const struct ata_port_info *ppi[] = { &info, NULL }; |
201 | return ata_pci_init_one(dev, port_info, 2); | 201 | return ata_pci_init_one(dev, ppi); |
202 | } | 202 | } |
203 | 203 | ||
204 | static const struct pci_device_id ns87410[] = { | 204 | static const struct pci_device_id ns87410[] = { |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index d59002e7528d..29c23ddd6550 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -289,20 +289,20 @@ static const struct ata_port_operations oldpiix_pata_ops = { | |||
289 | static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 289 | static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
290 | { | 290 | { |
291 | static int printed_version; | 291 | static int printed_version; |
292 | static struct ata_port_info info = { | 292 | static const struct ata_port_info info = { |
293 | .sht = &oldpiix_sht, | 293 | .sht = &oldpiix_sht, |
294 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 294 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
295 | .pio_mask = 0x1f, /* pio0-4 */ | 295 | .pio_mask = 0x1f, /* pio0-4 */ |
296 | .mwdma_mask = 0x07, /* mwdma1-2 */ | 296 | .mwdma_mask = 0x07, /* mwdma1-2 */ |
297 | .port_ops = &oldpiix_pata_ops, | 297 | .port_ops = &oldpiix_pata_ops, |
298 | }; | 298 | }; |
299 | static struct ata_port_info *port_info[2] = { &info, &info }; | 299 | const struct ata_port_info *ppi[] = { &info, NULL }; |
300 | 300 | ||
301 | if (!printed_version++) | 301 | if (!printed_version++) |
302 | dev_printk(KERN_DEBUG, &pdev->dev, | 302 | dev_printk(KERN_DEBUG, &pdev->dev, |
303 | "version " DRV_VERSION "\n"); | 303 | "version " DRV_VERSION "\n"); |
304 | 304 | ||
305 | return ata_pci_init_one(pdev, port_info, 2); | 305 | return ata_pci_init_one(pdev, ppi); |
306 | } | 306 | } |
307 | 307 | ||
308 | static const struct pci_device_id oldpiix_pci_tbl[] = { | 308 | static const struct pci_device_id oldpiix_pci_tbl[] = { |
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c index 944b7084b459..1c44653e1e06 100644 --- a/drivers/ata/pata_opti.c +++ b/drivers/ata/pata_opti.c | |||
@@ -216,19 +216,19 @@ static struct ata_port_operations opti_port_ops = { | |||
216 | 216 | ||
217 | static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 217 | static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
218 | { | 218 | { |
219 | static struct ata_port_info info = { | 219 | static const struct ata_port_info info = { |
220 | .sht = &opti_sht, | 220 | .sht = &opti_sht, |
221 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 221 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
222 | .pio_mask = 0x1f, | 222 | .pio_mask = 0x1f, |
223 | .port_ops = &opti_port_ops | 223 | .port_ops = &opti_port_ops |
224 | }; | 224 | }; |
225 | static struct ata_port_info *port_info[2] = { &info, &info }; | 225 | const struct ata_port_info *ppi[] = { &info, NULL }; |
226 | static int printed_version; | 226 | static int printed_version; |
227 | 227 | ||
228 | if (!printed_version++) | 228 | if (!printed_version++) |
229 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 229 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
230 | 230 | ||
231 | return ata_pci_init_one(dev, port_info, 2); | 231 | return ata_pci_init_one(dev, ppi); |
232 | } | 232 | } |
233 | 233 | ||
234 | static const struct pci_device_id opti[] = { | 234 | static const struct pci_device_id opti[] = { |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 875ac4a49dd7..3093b02286ce 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -482,14 +482,14 @@ done_nomsg: /* Wrong chip revision */ | |||
482 | 482 | ||
483 | static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 483 | static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
484 | { | 484 | { |
485 | static struct ata_port_info info_82c700 = { | 485 | static const struct ata_port_info info_82c700 = { |
486 | .sht = &optidma_sht, | 486 | .sht = &optidma_sht, |
487 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 487 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
488 | .pio_mask = 0x1f, | 488 | .pio_mask = 0x1f, |
489 | .mwdma_mask = 0x07, | 489 | .mwdma_mask = 0x07, |
490 | .port_ops = &optidma_port_ops | 490 | .port_ops = &optidma_port_ops |
491 | }; | 491 | }; |
492 | static struct ata_port_info info_82c700_udma = { | 492 | static const struct ata_port_info info_82c700_udma = { |
493 | .sht = &optidma_sht, | 493 | .sht = &optidma_sht, |
494 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 494 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
495 | .pio_mask = 0x1f, | 495 | .pio_mask = 0x1f, |
@@ -497,8 +497,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
497 | .udma_mask = 0x07, | 497 | .udma_mask = 0x07, |
498 | .port_ops = &optiplus_port_ops | 498 | .port_ops = &optiplus_port_ops |
499 | }; | 499 | }; |
500 | static struct ata_port_info *port_info[2]; | 500 | const struct ata_port_info *ppi[] = { &info_82c700, NULL }; |
501 | struct ata_port_info *info = &info_82c700; | ||
502 | static int printed_version; | 501 | static int printed_version; |
503 | 502 | ||
504 | if (!printed_version++) | 503 | if (!printed_version++) |
@@ -510,10 +509,9 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
510 | pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ | 509 | pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ |
511 | 510 | ||
512 | if (optiplus_with_udma(dev)) | 511 | if (optiplus_with_udma(dev)) |
513 | info = &info_82c700_udma; | 512 | ppi[0] = &info_82c700_udma; |
514 | 513 | ||
515 | port_info[0] = port_info[1] = info; | 514 | return ata_pci_init_one(dev, ppi); |
516 | return ata_pci_init_one(dev, port_info, 2); | ||
517 | } | 515 | } |
518 | 516 | ||
519 | static const struct pci_device_id optidma[] = { | 517 | static const struct pci_device_id optidma[] = { |
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index 3e204c329d51..edbaf9d653b8 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -317,7 +317,7 @@ static struct ata_port_operations pdc2026x_port_ops = { | |||
317 | 317 | ||
318 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 318 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
319 | { | 319 | { |
320 | static struct ata_port_info info[3] = { | 320 | static const struct ata_port_info info[3] = { |
321 | { | 321 | { |
322 | .sht = &pdc202xx_sht, | 322 | .sht = &pdc202xx_sht, |
323 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 323 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -344,9 +344,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
344 | } | 344 | } |
345 | 345 | ||
346 | }; | 346 | }; |
347 | static struct ata_port_info *port_info[2]; | 347 | const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; |
348 | |||
349 | port_info[0] = port_info[1] = &info[id->driver_data]; | ||
350 | 348 | ||
351 | if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { | 349 | if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { |
352 | struct pci_dev *bridge = dev->bus->self; | 350 | struct pci_dev *bridge = dev->bus->self; |
@@ -358,7 +356,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
358 | return -ENODEV; | 356 | return -ENODEV; |
359 | } | 357 | } |
360 | } | 358 | } |
361 | return ata_pci_init_one(dev, port_info, 2); | 359 | return ata_pci_init_one(dev, ppi); |
362 | } | 360 | } |
363 | 361 | ||
364 | static const struct pci_device_id pdc202xx[] = { | 362 | static const struct pci_device_id pdc202xx[] = { |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index bc01b17a00c2..ba96b54f5b87 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -255,7 +255,7 @@ static const struct ata_port_operations radisys_pata_ops = { | |||
255 | static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 255 | static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
256 | { | 256 | { |
257 | static int printed_version; | 257 | static int printed_version; |
258 | static struct ata_port_info info = { | 258 | static const struct ata_port_info info = { |
259 | .sht = &radisys_sht, | 259 | .sht = &radisys_sht, |
260 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 260 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
261 | .pio_mask = 0x1f, /* pio0-4 */ | 261 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -263,13 +263,13 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
263 | .udma_mask = 0x14, /* UDMA33/66 only */ | 263 | .udma_mask = 0x14, /* UDMA33/66 only */ |
264 | .port_ops = &radisys_pata_ops, | 264 | .port_ops = &radisys_pata_ops, |
265 | }; | 265 | }; |
266 | static struct ata_port_info *port_info[2] = { &info, &info }; | 266 | const struct ata_port_info *ppi[] = { &info, NULL }; |
267 | 267 | ||
268 | if (!printed_version++) | 268 | if (!printed_version++) |
269 | dev_printk(KERN_DEBUG, &pdev->dev, | 269 | dev_printk(KERN_DEBUG, &pdev->dev, |
270 | "version " DRV_VERSION "\n"); | 270 | "version " DRV_VERSION "\n"); |
271 | 271 | ||
272 | return ata_pci_init_one(pdev, port_info, 2); | 272 | return ata_pci_init_one(pdev, ppi); |
273 | } | 273 | } |
274 | 274 | ||
275 | static const struct pci_device_id radisys_pci_tbl[] = { | 275 | static const struct pci_device_id radisys_pci_tbl[] = { |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 97785b4f1efa..2bfd7ef42af5 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -131,22 +131,20 @@ static int rz1000_fifo_disable(struct pci_dev *pdev) | |||
131 | static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 131 | static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
132 | { | 132 | { |
133 | static int printed_version; | 133 | static int printed_version; |
134 | struct ata_port_info *port_info[2]; | 134 | static const struct ata_port_info info = { |
135 | static struct ata_port_info info = { | ||
136 | .sht = &rz1000_sht, | 135 | .sht = &rz1000_sht, |
137 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 136 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
138 | .pio_mask = 0x1f, | 137 | .pio_mask = 0x1f, |
139 | .port_ops = &rz1000_port_ops | 138 | .port_ops = &rz1000_port_ops |
140 | }; | 139 | }; |
140 | const struct ata_port_info *ppi[] = { &info, NULL }; | ||
141 | 141 | ||
142 | if (!printed_version++) | 142 | if (!printed_version++) |
143 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 143 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); |
144 | 144 | ||
145 | if (rz1000_fifo_disable(pdev) == 0) { | 145 | if (rz1000_fifo_disable(pdev) == 0) |
146 | port_info[0] = &info; | 146 | return ata_pci_init_one(pdev, ppi); |
147 | port_info[1] = &info; | 147 | |
148 | return ata_pci_init_one(pdev, port_info, 2); | ||
149 | } | ||
150 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); | 148 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); |
151 | /* Not safe to use so skip */ | 149 | /* Not safe to use so skip */ |
152 | return -ENODEV; | 150 | return -ENODEV; |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 2af9f8c8bd1f..225013ecf4b6 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -243,7 +243,7 @@ static struct ata_port_operations sc1200_port_ops = { | |||
243 | 243 | ||
244 | static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 244 | static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
245 | { | 245 | { |
246 | static struct ata_port_info info = { | 246 | static const struct ata_port_info info = { |
247 | .sht = &sc1200_sht, | 247 | .sht = &sc1200_sht, |
248 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 248 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
249 | .pio_mask = 0x1f, | 249 | .pio_mask = 0x1f, |
@@ -251,10 +251,10 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
251 | .udma_mask = 0x07, | 251 | .udma_mask = 0x07, |
252 | .port_ops = &sc1200_port_ops | 252 | .port_ops = &sc1200_port_ops |
253 | }; | 253 | }; |
254 | static struct ata_port_info *port_info[2] = { &info, &info }; | ||
255 | |||
256 | /* Can't enable port 2 yet, see top comments */ | 254 | /* Can't enable port 2 yet, see top comments */ |
257 | return ata_pci_init_one(dev, port_info, 1); | 255 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
256 | |||
257 | return ata_pci_init_one(dev, ppi); | ||
258 | } | 258 | } |
259 | 259 | ||
260 | static const struct pci_device_id sc1200[] = { | 260 | static const struct pci_device_id sc1200[] = { |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index 8bbe4266f760..dee6e211949d 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -475,8 +475,7 @@ static void serverworks_fixup_ht1000(struct pci_dev *pdev) | |||
475 | 475 | ||
476 | static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 476 | static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
477 | { | 477 | { |
478 | int ports = 2; | 478 | static const struct ata_port_info info[4] = { |
479 | static struct ata_port_info info[4] = { | ||
480 | { /* OSB4 */ | 479 | { /* OSB4 */ |
481 | .sht = &serverworks_sht, | 480 | .sht = &serverworks_sht, |
482 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 481 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -507,8 +506,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
507 | .port_ops = &serverworks_csb_port_ops | 506 | .port_ops = &serverworks_csb_port_ops |
508 | } | 507 | } |
509 | }; | 508 | }; |
510 | static struct ata_port_info *port_info[2]; | 509 | const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; |
511 | struct ata_port_info *devinfo = &info[id->driver_data]; | ||
512 | 510 | ||
513 | /* Force master latency timer to 64 PCI clocks */ | 511 | /* Force master latency timer to 64 PCI clocks */ |
514 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); | 512 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); |
@@ -517,7 +515,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
517 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | 515 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
518 | /* Select non UDMA capable OSB4 if we can't do fixups */ | 516 | /* Select non UDMA capable OSB4 if we can't do fixups */ |
519 | if ( serverworks_fixup_osb4(pdev) < 0) | 517 | if ( serverworks_fixup_osb4(pdev) < 0) |
520 | devinfo = &info[1]; | 518 | ppi[0] = &info[1]; |
521 | } | 519 | } |
522 | /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ | 520 | /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ |
523 | else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || | 521 | else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || |
@@ -527,11 +525,11 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
527 | /* If the returned btr is the newer revision then | 525 | /* If the returned btr is the newer revision then |
528 | select the right info block */ | 526 | select the right info block */ |
529 | if (serverworks_fixup_csb(pdev) == 3) | 527 | if (serverworks_fixup_csb(pdev) == 3) |
530 | devinfo = &info[3]; | 528 | ppi[0] = &info[3]; |
531 | 529 | ||
532 | /* Is this the 3rd channel CSB6 IDE ? */ | 530 | /* Is this the 3rd channel CSB6 IDE ? */ |
533 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) | 531 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) |
534 | ports = 1; | 532 | ppi[1] = &ata_dummy_port_info; |
535 | } | 533 | } |
536 | /* setup HT1000E */ | 534 | /* setup HT1000E */ |
537 | else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) | 535 | else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) |
@@ -540,8 +538,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
540 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 538 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
541 | ata_pci_clear_simplex(pdev); | 539 | ata_pci_clear_simplex(pdev); |
542 | 540 | ||
543 | port_info[0] = port_info[1] = devinfo; | 541 | return ata_pci_init_one(pdev, ppi); |
544 | return ata_pci_init_one(pdev, port_info, ports); | ||
545 | } | 542 | } |
546 | 543 | ||
547 | #ifdef CONFIG_PM | 544 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 8c0b25f145ae..440e2cb6ee75 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -341,7 +341,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev) | |||
341 | 341 | ||
342 | static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 342 | static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
343 | { | 343 | { |
344 | static struct ata_port_info info = { | 344 | static const struct ata_port_info info = { |
345 | .sht = &sil680_sht, | 345 | .sht = &sil680_sht, |
346 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 346 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
347 | .pio_mask = 0x1f, | 347 | .pio_mask = 0x1f, |
@@ -349,7 +349,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
349 | .udma_mask = 0x7f, | 349 | .udma_mask = 0x7f, |
350 | .port_ops = &sil680_port_ops | 350 | .port_ops = &sil680_port_ops |
351 | }; | 351 | }; |
352 | static struct ata_port_info info_slow = { | 352 | static const struct ata_port_info info_slow = { |
353 | .sht = &sil680_sht, | 353 | .sht = &sil680_sht, |
354 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 354 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
355 | .pio_mask = 0x1f, | 355 | .pio_mask = 0x1f, |
@@ -357,7 +357,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
357 | .udma_mask = 0x3f, | 357 | .udma_mask = 0x3f, |
358 | .port_ops = &sil680_port_ops | 358 | .port_ops = &sil680_port_ops |
359 | }; | 359 | }; |
360 | static struct ata_port_info *port_info[2] = {&info, &info}; | 360 | const struct ata_port_info *ppi[] = { &info, NULL }; |
361 | static int printed_version; | 361 | static int printed_version; |
362 | 362 | ||
363 | if (!printed_version++) | 363 | if (!printed_version++) |
@@ -366,12 +366,12 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
366 | switch(sil680_init_chip(pdev)) | 366 | switch(sil680_init_chip(pdev)) |
367 | { | 367 | { |
368 | case 0: | 368 | case 0: |
369 | port_info[0] = port_info[1] = &info_slow; | 369 | ppi[0] = &info_slow; |
370 | break; | 370 | break; |
371 | case 0x30: | 371 | case 0x30: |
372 | return -ENODEV; | 372 | return -ENODEV; |
373 | } | 373 | } |
374 | return ata_pci_init_one(pdev, port_info, 2); | 374 | return ata_pci_init_one(pdev, ppi); |
375 | } | 375 | } |
376 | 376 | ||
377 | #ifdef CONFIG_PM | 377 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 9b3774a4775a..f2231267e011 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -38,8 +38,8 @@ | |||
38 | #define DRV_VERSION "0.5.1" | 38 | #define DRV_VERSION "0.5.1" |
39 | 39 | ||
40 | struct sis_chipset { | 40 | struct sis_chipset { |
41 | u16 device; /* PCI host ID */ | 41 | u16 device; /* PCI host ID */ |
42 | struct ata_port_info *info; /* Info block */ | 42 | const struct ata_port_info *info; /* Info block */ |
43 | /* Probably add family, cable detect type etc here to clean | 43 | /* Probably add family, cable detect type etc here to clean |
44 | up code later */ | 44 | up code later */ |
45 | }; | 45 | }; |
@@ -696,7 +696,7 @@ static const struct ata_port_operations sis_old_ops = { | |||
696 | .port_start = ata_port_start, | 696 | .port_start = ata_port_start, |
697 | }; | 697 | }; |
698 | 698 | ||
699 | static struct ata_port_info sis_info = { | 699 | static const struct ata_port_info sis_info = { |
700 | .sht = &sis_sht, | 700 | .sht = &sis_sht, |
701 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 701 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
702 | .pio_mask = 0x1f, /* pio0-4 */ | 702 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -704,7 +704,7 @@ static struct ata_port_info sis_info = { | |||
704 | .udma_mask = 0, | 704 | .udma_mask = 0, |
705 | .port_ops = &sis_old_ops, | 705 | .port_ops = &sis_old_ops, |
706 | }; | 706 | }; |
707 | static struct ata_port_info sis_info33 = { | 707 | static const struct ata_port_info sis_info33 = { |
708 | .sht = &sis_sht, | 708 | .sht = &sis_sht, |
709 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 709 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
710 | .pio_mask = 0x1f, /* pio0-4 */ | 710 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -712,35 +712,35 @@ static struct ata_port_info sis_info33 = { | |||
712 | .udma_mask = ATA_UDMA2, /* UDMA 33 */ | 712 | .udma_mask = ATA_UDMA2, /* UDMA 33 */ |
713 | .port_ops = &sis_old_ops, | 713 | .port_ops = &sis_old_ops, |
714 | }; | 714 | }; |
715 | static struct ata_port_info sis_info66 = { | 715 | static const struct ata_port_info sis_info66 = { |
716 | .sht = &sis_sht, | 716 | .sht = &sis_sht, |
717 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 717 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
718 | .pio_mask = 0x1f, /* pio0-4 */ | 718 | .pio_mask = 0x1f, /* pio0-4 */ |
719 | .udma_mask = ATA_UDMA4, /* UDMA 66 */ | 719 | .udma_mask = ATA_UDMA4, /* UDMA 66 */ |
720 | .port_ops = &sis_66_ops, | 720 | .port_ops = &sis_66_ops, |
721 | }; | 721 | }; |
722 | static struct ata_port_info sis_info100 = { | 722 | static const struct ata_port_info sis_info100 = { |
723 | .sht = &sis_sht, | 723 | .sht = &sis_sht, |
724 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 724 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
725 | .pio_mask = 0x1f, /* pio0-4 */ | 725 | .pio_mask = 0x1f, /* pio0-4 */ |
726 | .udma_mask = ATA_UDMA5, | 726 | .udma_mask = ATA_UDMA5, |
727 | .port_ops = &sis_100_ops, | 727 | .port_ops = &sis_100_ops, |
728 | }; | 728 | }; |
729 | static struct ata_port_info sis_info100_early = { | 729 | static const struct ata_port_info sis_info100_early = { |
730 | .sht = &sis_sht, | 730 | .sht = &sis_sht, |
731 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 731 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
732 | .udma_mask = ATA_UDMA5, | 732 | .udma_mask = ATA_UDMA5, |
733 | .pio_mask = 0x1f, /* pio0-4 */ | 733 | .pio_mask = 0x1f, /* pio0-4 */ |
734 | .port_ops = &sis_66_ops, | 734 | .port_ops = &sis_66_ops, |
735 | }; | 735 | }; |
736 | struct ata_port_info sis_info133 = { | 736 | const struct ata_port_info sis_info133 = { |
737 | .sht = &sis_sht, | 737 | .sht = &sis_sht, |
738 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 738 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
739 | .pio_mask = 0x1f, /* pio0-4 */ | 739 | .pio_mask = 0x1f, /* pio0-4 */ |
740 | .udma_mask = ATA_UDMA6, | 740 | .udma_mask = ATA_UDMA6, |
741 | .port_ops = &sis_133_ops, | 741 | .port_ops = &sis_133_ops, |
742 | }; | 742 | }; |
743 | static struct ata_port_info sis_info133_early = { | 743 | static const struct ata_port_info sis_info133_early = { |
744 | .sht = &sis_sht, | 744 | .sht = &sis_sht, |
745 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 745 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
746 | .pio_mask = 0x1f, /* pio0-4 */ | 746 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -823,8 +823,8 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) | |||
823 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 823 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
824 | { | 824 | { |
825 | static int printed_version; | 825 | static int printed_version; |
826 | static struct ata_port_info *port_info[2]; | 826 | struct ata_port_info port; |
827 | struct ata_port_info *port; | 827 | const struct ata_port_info *ppi[] = { &port, NULL }; |
828 | struct pci_dev *host = NULL; | 828 | struct pci_dev *host = NULL; |
829 | struct sis_chipset *chipset = NULL; | 829 | struct sis_chipset *chipset = NULL; |
830 | struct sis_chipset *sets; | 830 | struct sis_chipset *sets; |
@@ -964,13 +964,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
964 | if (chipset == NULL) | 964 | if (chipset == NULL) |
965 | return -ENODEV; | 965 | return -ENODEV; |
966 | 966 | ||
967 | port = chipset->info; | 967 | port = *chipset->info; |
968 | port->private_data = chipset; | 968 | port.private_data = chipset; |
969 | 969 | ||
970 | sis_fixup(pdev, chipset); | 970 | sis_fixup(pdev, chipset); |
971 | 971 | ||
972 | port_info[0] = port_info[1] = port; | 972 | return ata_pci_init_one(pdev, ppi); |
973 | return ata_pci_init_one(pdev, port_info, 2); | ||
974 | } | 973 | } |
975 | 974 | ||
976 | static const struct pci_device_id sis_pci_tbl[] = { | 975 | static const struct pci_device_id sis_pci_tbl[] = { |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 9aeffdbe2829..f48491ad5f3a 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -301,20 +301,22 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev) | |||
301 | 301 | ||
302 | static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 302 | static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
303 | { | 303 | { |
304 | static struct ata_port_info info_dma = { | 304 | static const struct ata_port_info info_dma = { |
305 | .sht = &sl82c105_sht, | 305 | .sht = &sl82c105_sht, |
306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
307 | .pio_mask = 0x1f, | 307 | .pio_mask = 0x1f, |
308 | .mwdma_mask = 0x07, | 308 | .mwdma_mask = 0x07, |
309 | .port_ops = &sl82c105_port_ops | 309 | .port_ops = &sl82c105_port_ops |
310 | }; | 310 | }; |
311 | static struct ata_port_info info_early = { | 311 | static const struct ata_port_info info_early = { |
312 | .sht = &sl82c105_sht, | 312 | .sht = &sl82c105_sht, |
313 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 313 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
314 | .pio_mask = 0x1f, | 314 | .pio_mask = 0x1f, |
315 | .port_ops = &sl82c105_port_ops | 315 | .port_ops = &sl82c105_port_ops |
316 | }; | 316 | }; |
317 | static struct ata_port_info *port_info[2] = { &info_early, &info_early }; | 317 | /* for now use only the first port */ |
318 | const struct ata_port_info *ppi[] = { &info_early, | ||
319 | &ata_dummy_port_info }; | ||
318 | u32 val; | 320 | u32 val; |
319 | int rev; | 321 | int rev; |
320 | 322 | ||
@@ -324,17 +326,14 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
324 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); | 326 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); |
325 | else if (rev <= 5) | 327 | else if (rev <= 5) |
326 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); | 328 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); |
327 | else { | 329 | else |
328 | port_info[0] = &info_dma; | 330 | ppi[0] = &info_dma; |
329 | port_info[1] = &info_dma; | ||
330 | } | ||
331 | 331 | ||
332 | pci_read_config_dword(dev, 0x40, &val); | 332 | pci_read_config_dword(dev, 0x40, &val); |
333 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; | 333 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; |
334 | pci_write_config_dword(dev, 0x40, val); | 334 | pci_write_config_dword(dev, 0x40, val); |
335 | 335 | ||
336 | 336 | return ata_pci_init_one(dev, ppi); | |
337 | return ata_pci_init_one(dev, port_info, 1); /* For now */ | ||
338 | } | 337 | } |
339 | 338 | ||
340 | static const struct pci_device_id sl82c105[] = { | 339 | static const struct pci_device_id sl82c105[] = { |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index 045f9d2832df..b1d3076dfe51 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
@@ -233,20 +233,20 @@ static struct ata_port_operations triflex_port_ops = { | |||
233 | 233 | ||
234 | static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 234 | static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
235 | { | 235 | { |
236 | static struct ata_port_info info = { | 236 | static const struct ata_port_info info = { |
237 | .sht = &triflex_sht, | 237 | .sht = &triflex_sht, |
238 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 238 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
239 | .pio_mask = 0x1f, | 239 | .pio_mask = 0x1f, |
240 | .mwdma_mask = 0x07, | 240 | .mwdma_mask = 0x07, |
241 | .port_ops = &triflex_port_ops | 241 | .port_ops = &triflex_port_ops |
242 | }; | 242 | }; |
243 | static struct ata_port_info *port_info[2] = { &info, &info }; | 243 | const struct ata_port_info *ppi[] = { &info, NULL }; |
244 | static int printed_version; | 244 | static int printed_version; |
245 | 245 | ||
246 | if (!printed_version++) | 246 | if (!printed_version++) |
247 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 247 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
248 | 248 | ||
249 | return ata_pci_init_one(dev, port_info, 2); | 249 | return ata_pci_init_one(dev, ppi); |
250 | } | 250 | } |
251 | 251 | ||
252 | static const struct pci_device_id triflex[] = { | 252 | static const struct pci_device_id triflex[] = { |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 3740644e7f43..e4c71f76bd55 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -421,7 +421,7 @@ static void via_config_fifo(struct pci_dev *pdev, unsigned int flags) | |||
421 | static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 421 | static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
422 | { | 422 | { |
423 | /* Early VIA without UDMA support */ | 423 | /* Early VIA without UDMA support */ |
424 | static struct ata_port_info via_mwdma_info = { | 424 | static const struct ata_port_info via_mwdma_info = { |
425 | .sht = &via_sht, | 425 | .sht = &via_sht, |
426 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 426 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
427 | .pio_mask = 0x1f, | 427 | .pio_mask = 0x1f, |
@@ -429,7 +429,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
429 | .port_ops = &via_port_ops | 429 | .port_ops = &via_port_ops |
430 | }; | 430 | }; |
431 | /* Ditto with IRQ masking required */ | 431 | /* Ditto with IRQ masking required */ |
432 | static struct ata_port_info via_mwdma_info_borked = { | 432 | static const struct ata_port_info via_mwdma_info_borked = { |
433 | .sht = &via_sht, | 433 | .sht = &via_sht, |
434 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 434 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
435 | .pio_mask = 0x1f, | 435 | .pio_mask = 0x1f, |
@@ -437,7 +437,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
437 | .port_ops = &via_port_ops_noirq, | 437 | .port_ops = &via_port_ops_noirq, |
438 | }; | 438 | }; |
439 | /* VIA UDMA 33 devices (and borked 66) */ | 439 | /* VIA UDMA 33 devices (and borked 66) */ |
440 | static struct ata_port_info via_udma33_info = { | 440 | static const struct ata_port_info via_udma33_info = { |
441 | .sht = &via_sht, | 441 | .sht = &via_sht, |
442 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 442 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
443 | .pio_mask = 0x1f, | 443 | .pio_mask = 0x1f, |
@@ -446,7 +446,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
446 | .port_ops = &via_port_ops | 446 | .port_ops = &via_port_ops |
447 | }; | 447 | }; |
448 | /* VIA UDMA 66 devices */ | 448 | /* VIA UDMA 66 devices */ |
449 | static struct ata_port_info via_udma66_info = { | 449 | static const struct ata_port_info via_udma66_info = { |
450 | .sht = &via_sht, | 450 | .sht = &via_sht, |
451 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 451 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
452 | .pio_mask = 0x1f, | 452 | .pio_mask = 0x1f, |
@@ -455,7 +455,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
455 | .port_ops = &via_port_ops | 455 | .port_ops = &via_port_ops |
456 | }; | 456 | }; |
457 | /* VIA UDMA 100 devices */ | 457 | /* VIA UDMA 100 devices */ |
458 | static struct ata_port_info via_udma100_info = { | 458 | static const struct ata_port_info via_udma100_info = { |
459 | .sht = &via_sht, | 459 | .sht = &via_sht, |
460 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 460 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
461 | .pio_mask = 0x1f, | 461 | .pio_mask = 0x1f, |
@@ -464,7 +464,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
464 | .port_ops = &via_port_ops | 464 | .port_ops = &via_port_ops |
465 | }; | 465 | }; |
466 | /* UDMA133 with bad AST (All current 133) */ | 466 | /* UDMA133 with bad AST (All current 133) */ |
467 | static struct ata_port_info via_udma133_info = { | 467 | static const struct ata_port_info via_udma133_info = { |
468 | .sht = &via_sht, | 468 | .sht = &via_sht, |
469 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 469 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
470 | .pio_mask = 0x1f, | 470 | .pio_mask = 0x1f, |
@@ -472,7 +472,8 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
472 | .udma_mask = 0x7f, /* FIXME: should check north bridge */ | 472 | .udma_mask = 0x7f, /* FIXME: should check north bridge */ |
473 | .port_ops = &via_port_ops | 473 | .port_ops = &via_port_ops |
474 | }; | 474 | }; |
475 | struct ata_port_info *port_info[2], *type; | 475 | struct ata_port_info type; |
476 | const struct ata_port_info *ppi[] = { &type, NULL }; | ||
476 | struct pci_dev *isa = NULL; | 477 | struct pci_dev *isa = NULL; |
477 | const struct via_isa_bridge *config; | 478 | const struct via_isa_bridge *config; |
478 | static int printed_version; | 479 | static int printed_version; |
@@ -517,25 +518,25 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
517 | switch(config->flags & VIA_UDMA) { | 518 | switch(config->flags & VIA_UDMA) { |
518 | case VIA_UDMA_NONE: | 519 | case VIA_UDMA_NONE: |
519 | if (config->flags & VIA_NO_UNMASK) | 520 | if (config->flags & VIA_NO_UNMASK) |
520 | type = &via_mwdma_info_borked; | 521 | type = via_mwdma_info_borked; |
521 | else | 522 | else |
522 | type = &via_mwdma_info; | 523 | type = via_mwdma_info; |
523 | break; | 524 | break; |
524 | case VIA_UDMA_33: | 525 | case VIA_UDMA_33: |
525 | type = &via_udma33_info; | 526 | type = via_udma33_info; |
526 | break; | 527 | break; |
527 | case VIA_UDMA_66: | 528 | case VIA_UDMA_66: |
528 | type = &via_udma66_info; | 529 | type = via_udma66_info; |
529 | /* The 66 MHz devices require we enable the clock */ | 530 | /* The 66 MHz devices require we enable the clock */ |
530 | pci_read_config_dword(pdev, 0x50, &timing); | 531 | pci_read_config_dword(pdev, 0x50, &timing); |
531 | timing |= 0x80008; | 532 | timing |= 0x80008; |
532 | pci_write_config_dword(pdev, 0x50, timing); | 533 | pci_write_config_dword(pdev, 0x50, timing); |
533 | break; | 534 | break; |
534 | case VIA_UDMA_100: | 535 | case VIA_UDMA_100: |
535 | type = &via_udma100_info; | 536 | type = via_udma100_info; |
536 | break; | 537 | break; |
537 | case VIA_UDMA_133: | 538 | case VIA_UDMA_133: |
538 | type = &via_udma133_info; | 539 | type = via_udma133_info; |
539 | break; | 540 | break; |
540 | default: | 541 | default: |
541 | WARN_ON(1); | 542 | WARN_ON(1); |
@@ -550,10 +551,9 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
550 | } | 551 | } |
551 | 552 | ||
552 | /* We have established the device type, now fire it up */ | 553 | /* We have established the device type, now fire it up */ |
553 | type->private_data = (void *)config; | 554 | type.private_data = (void *)config; |
554 | 555 | ||
555 | port_info[0] = port_info[1] = type; | 556 | return ata_pci_init_one(pdev, ppi); |
556 | return ata_pci_init_one(pdev, port_info, 2); | ||
557 | } | 557 | } |
558 | 558 | ||
559 | #ifdef CONFIG_PM | 559 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 6962f8e492f5..4cea3ef75226 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -457,7 +457,7 @@ static const struct ata_port_operations nv_adma_ops = { | |||
457 | .host_stop = nv_adma_host_stop, | 457 | .host_stop = nv_adma_host_stop, |
458 | }; | 458 | }; |
459 | 459 | ||
460 | static struct ata_port_info nv_port_info[] = { | 460 | static const struct ata_port_info nv_port_info[] = { |
461 | /* generic */ | 461 | /* generic */ |
462 | { | 462 | { |
463 | .sht = &nv_sht, | 463 | .sht = &nv_sht, |
@@ -1537,7 +1537,7 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1537 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 1537 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
1538 | { | 1538 | { |
1539 | static int printed_version = 0; | 1539 | static int printed_version = 0; |
1540 | const struct ata_port_info *ppi[2]; | 1540 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
1541 | struct ata_host *host; | 1541 | struct ata_host *host; |
1542 | struct nv_host_priv *hpriv; | 1542 | struct nv_host_priv *hpriv; |
1543 | int rc; | 1543 | int rc; |
@@ -1565,8 +1565,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1565 | type = ADMA; | 1565 | type = ADMA; |
1566 | } | 1566 | } |
1567 | 1567 | ||
1568 | ppi[0] = ppi[1] = &nv_port_info[type]; | 1568 | ppi[0] = &nv_port_info[type]; |
1569 | rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | 1569 | rc = ata_pci_prepare_native_host(pdev, ppi, &host); |
1570 | if (rc) | 1570 | if (rc) |
1571 | return rc; | 1571 | return rc; |
1572 | 1572 | ||
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index d8ee062e82fc..ee66c5fa7ac8 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -129,7 +129,7 @@ static const struct ata_port_operations sis_ops = { | |||
129 | .port_start = ata_port_start, | 129 | .port_start = ata_port_start, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct ata_port_info sis_port_info = { | 132 | static const struct ata_port_info sis_port_info = { |
133 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 133 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
134 | .pio_mask = 0x1f, | 134 | .pio_mask = 0x1f, |
135 | .mwdma_mask = 0x7, | 135 | .mwdma_mask = 0x7, |
@@ -255,7 +255,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
255 | { | 255 | { |
256 | static int printed_version; | 256 | static int printed_version; |
257 | struct ata_port_info pi = sis_port_info; | 257 | struct ata_port_info pi = sis_port_info; |
258 | const struct ata_port_info *ppi[2] = { &pi, &pi }; | 258 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
259 | struct ata_host *host; | 259 | struct ata_host *host; |
260 | u32 genctl, val; | 260 | u32 genctl, val; |
261 | u8 pmr; | 261 | u8 pmr; |
@@ -335,7 +335,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | 337 | ||
338 | rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | 338 | rc = ata_pci_prepare_native_host(pdev, ppi, &host); |
339 | if (rc) | 339 | if (rc) |
340 | return rc; | 340 | return rc; |
341 | 341 | ||
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index f74e383de083..006f5e352658 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -125,7 +125,7 @@ static const struct ata_port_operations uli_ops = { | |||
125 | .port_start = ata_port_start, | 125 | .port_start = ata_port_start, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static struct ata_port_info uli_port_info = { | 128 | static const struct ata_port_info uli_port_info = { |
129 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 129 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
130 | ATA_FLAG_IGN_SIMPLEX, | 130 | ATA_FLAG_IGN_SIMPLEX, |
131 | .pio_mask = 0x1f, /* pio0-4 */ | 131 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -201,19 +201,33 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
201 | n_ports = 2; | 201 | n_ports = 2; |
202 | if (board_idx == uli_5287) | 202 | if (board_idx == uli_5287) |
203 | n_ports = 4; | 203 | n_ports = 4; |
204 | rc = ata_pci_prepare_native_host(pdev, ppi, n_ports, &host); | 204 | |
205 | if (rc) | 205 | /* allocate the host */ |
206 | return rc; | 206 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); |
207 | if (!host) | ||
208 | return -ENOMEM; | ||
207 | 209 | ||
208 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); | 210 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); |
209 | if (!hpriv) | 211 | if (!hpriv) |
210 | return -ENOMEM; | 212 | return -ENOMEM; |
211 | host->private_data = hpriv; | 213 | host->private_data = hpriv; |
212 | 214 | ||
215 | /* the first two ports are standard SFF */ | ||
216 | rc = ata_pci_init_native_host(host); | ||
217 | if (rc) | ||
218 | return rc; | ||
219 | |||
220 | rc = ata_pci_init_bmdma(host); | ||
221 | if (rc) | ||
222 | return rc; | ||
223 | |||
213 | iomap = host->iomap; | 224 | iomap = host->iomap; |
214 | 225 | ||
215 | switch (board_idx) { | 226 | switch (board_idx) { |
216 | case uli_5287: | 227 | case uli_5287: |
228 | /* If there are four, the last two live right after | ||
229 | * the standard SFF ports. | ||
230 | */ | ||
217 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; | 231 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; |
218 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; | 232 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; |
219 | 233 | ||
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 939c9246fdd1..814597a0a708 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -415,7 +415,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
415 | struct ata_host *host; | 415 | struct ata_host *host; |
416 | int rc; | 416 | int rc; |
417 | 417 | ||
418 | rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | 418 | rc = ata_pci_prepare_native_host(pdev, ppi, &host); |
419 | if (rc) | 419 | if (rc) |
420 | return rc; | 420 | return rc; |
421 | *r_host = host; | 421 | *r_host = host; |
diff --git a/drivers/ata/sis.h b/drivers/ata/sis.h index 231da8fc2200..0f2208d8d5ef 100644 --- a/drivers/ata/sis.h +++ b/drivers/ata/sis.h | |||
@@ -2,4 +2,4 @@ | |||
2 | struct ata_port_info; | 2 | struct ata_port_info; |
3 | 3 | ||
4 | /* pata_sis.c */ | 4 | /* pata_sis.c */ |
5 | extern struct ata_port_info sis_info133; | 5 | extern const struct ata_port_info sis_info133; |