Commit 1626aeb881236c8cb022b5e4ca594146a951d669
Committed by
Jeff Garzik
1 parent
920a4b1038
Exists in
master
and in
4 other branches
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>
Showing 43 changed files with 313 additions and 315 deletions Side-by-side Diff
- drivers/ata/ata_generic.c
- drivers/ata/ata_piix.c
- drivers/ata/libata-core.c
- drivers/ata/libata-sff.c
- drivers/ata/pata_ali.c
- drivers/ata/pata_amd.c
- drivers/ata/pata_artop.c
- drivers/ata/pata_atiixp.c
- drivers/ata/pata_cmd640.c
- drivers/ata/pata_cmd64x.c
- drivers/ata/pata_cs5530.c
- drivers/ata/pata_cs5535.c
- drivers/ata/pata_cypress.c
- drivers/ata/pata_efar.c
- drivers/ata/pata_hpt366.c
- drivers/ata/pata_hpt37x.c
- drivers/ata/pata_hpt3x2n.c
- drivers/ata/pata_hpt3x3.c
- drivers/ata/pata_it8213.c
- drivers/ata/pata_it821x.c
- drivers/ata/pata_jmicron.c
- drivers/ata/pata_marvell.c
- drivers/ata/pata_netcell.c
- drivers/ata/pata_ns87410.c
- drivers/ata/pata_oldpiix.c
- drivers/ata/pata_opti.c
- drivers/ata/pata_optidma.c
- drivers/ata/pata_pdc202xx_old.c
- drivers/ata/pata_radisys.c
- drivers/ata/pata_rz1000.c
- drivers/ata/pata_sc1200.c
- drivers/ata/pata_serverworks.c
- drivers/ata/pata_sil680.c
- drivers/ata/pata_sis.c
- drivers/ata/pata_sl82c105.c
- drivers/ata/pata_triflex.c
- drivers/ata/pata_via.c
- drivers/ata/sata_nv.c
- drivers/ata/sata_sis.c
- drivers/ata/sata_uli.c
- drivers/ata/sata_via.c
- drivers/ata/sis.h
- include/linux/libata.h
drivers/ata/ata_generic.c
... | ... | @@ -141,7 +141,7 @@ |
141 | 141 | static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
142 | 142 | { |
143 | 143 | u16 command; |
144 | - static struct ata_port_info info = { | |
144 | + static const struct ata_port_info info = { | |
145 | 145 | .sht = &generic_sht, |
146 | 146 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
147 | 147 | .pio_mask = 0x1f, |
... | ... | @@ -149,7 +149,7 @@ |
149 | 149 | .udma_mask = 0x3f, |
150 | 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 | 154 | /* Don't use the generic entry unless instructed to do so */ |
155 | 155 | if (id->driver_data == 1 && all_generic_ide == 0) |
... | ... | @@ -175,7 +175,7 @@ |
175 | 175 | if (dev->vendor == PCI_VENDOR_ID_AL) |
176 | 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 | 181 | static struct pci_device_id ata_generic[] = { |
drivers/ata/ata_piix.c
... | ... | @@ -1030,7 +1030,7 @@ |
1030 | 1030 | static int printed_version; |
1031 | 1031 | struct device *dev = &pdev->dev; |
1032 | 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 | 1034 | struct piix_host_priv *hpriv; |
1035 | 1035 | unsigned long port_flags; |
1036 | 1036 | |
... | ... | @@ -1089,7 +1089,7 @@ |
1089 | 1089 | port_info[1].mwdma_mask = 0; |
1090 | 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 | 1095 | static int __init piix_init(void) |
drivers/ata/libata-core.c
... | ... | @@ -6856,6 +6856,7 @@ |
6856 | 6856 | #ifdef CONFIG_PCI |
6857 | 6857 | EXPORT_SYMBOL_GPL(pci_test_config_bits); |
6858 | 6858 | EXPORT_SYMBOL_GPL(ata_pci_init_native_host); |
6859 | +EXPORT_SYMBOL_GPL(ata_pci_init_bmdma); | |
6859 | 6860 | EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host); |
6860 | 6861 | EXPORT_SYMBOL_GPL(ata_pci_init_one); |
6861 | 6862 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); |
drivers/ata/libata-sff.c
... | ... | @@ -544,7 +544,7 @@ |
544 | 544 | * RETURNS: |
545 | 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 | 549 | struct device *gdev = host->dev; |
550 | 550 | struct pci_dev *pdev = to_pci_dev(gdev); |
... | ... | @@ -566,7 +566,7 @@ |
566 | 566 | } |
567 | 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 | 570 | struct ata_port *ap = host->ports[i]; |
571 | 571 | void __iomem *bmdma = host->iomap[4] + 8 * i; |
572 | 572 | |
573 | 573 | |
574 | 574 | |
575 | 575 | |
576 | 576 | |
577 | 577 | |
578 | 578 | |
579 | 579 | |
580 | 580 | |
581 | 581 | |
... | ... | @@ -585,54 +585,52 @@ |
585 | 585 | /** |
586 | 586 | * ata_pci_init_native_host - acquire native ATA resources and init host |
587 | 587 | * @host: target ATA host |
588 | - * @port_mask: ports to consider | |
589 | 588 | * |
590 | - * Acquire native PCI ATA resources for @host and initialize | |
591 | - * @host accordoingly. | |
589 | + * Acquire native PCI ATA resources for @host and initialize the | |
590 | + * first two ports of @host accordingly. Ports marked dummy are | |
591 | + * skipped and allocation failure makes the port dummy. | |
592 | 592 | * |
593 | 593 | * LOCKING: |
594 | 594 | * Inherited from calling layer (may sleep). |
595 | 595 | * |
596 | 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 | 602 | struct device *gdev = host->dev; |
602 | 603 | struct pci_dev *pdev = to_pci_dev(gdev); |
604 | + unsigned int mask = 0; | |
603 | 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 | 607 | /* request, iomap BARs and init port addresses accordingly */ |
621 | 608 | for (i = 0; i < 2; i++) { |
622 | 609 | struct ata_port *ap = host->ports[i]; |
623 | 610 | int base = i * 2; |
624 | 611 | void __iomem * const *iomap; |
625 | 612 | |
626 | - if (!(port_mask & (1 << i))) | |
613 | + if (ata_port_is_dummy(ap)) | |
627 | 614 | continue; |
628 | 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; | |
622 | + continue; | |
623 | + } | |
624 | + | |
629 | 625 | rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME); |
630 | 626 | if (rc) { |
631 | - dev_printk(KERN_ERR, gdev, "failed to request/iomap " | |
632 | - "BARs for port %d (errno=%d)\n", i, rc); | |
627 | + dev_printk(KERN_WARNING, gdev, | |
628 | + "failed to request/iomap BARs for port %d " | |
629 | + "(errno=%d)\n", i, rc); | |
633 | 630 | if (rc == -EBUSY) |
634 | 631 | pcim_pin_device(pdev); |
635 | - return rc; | |
632 | + ap->ops = &ata_dummy_port_ops; | |
633 | + continue; | |
636 | 634 | } |
637 | 635 | host->iomap = iomap = pcim_iomap_table(pdev); |
638 | 636 | |
639 | 637 | |
640 | 638 | |
... | ... | @@ -641,16 +639,22 @@ |
641 | 639 | ap->ioaddr.ctl_addr = (void __iomem *) |
642 | 640 | ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); |
643 | 641 | ata_std_ports(&ap->ioaddr); |
642 | + | |
643 | + mask |= 1 << i; | |
644 | 644 | } |
645 | 645 | |
646 | + if (!mask) { | |
647 | + dev_printk(KERN_ERR, gdev, "no available native port\n"); | |
648 | + return -ENODEV; | |
649 | + } | |
650 | + | |
646 | 651 | return 0; |
647 | 652 | } |
648 | 653 | |
649 | 654 | /** |
650 | 655 | * ata_pci_prepare_native_host - helper to prepare native PCI ATA host |
651 | 656 | * @pdev: target PCI device |
652 | - * @ppi: array of port_info | |
653 | - * @n_ports: number of ports to allocate | |
657 | + * @ppi: array of port_info, must be enough for two ports | |
654 | 658 | * @r_host: out argument for the initialized ATA host |
655 | 659 | * |
656 | 660 | * Helper to allocate ATA host for @pdev, acquire all native PCI |
657 | 661 | |
... | ... | @@ -664,10 +668,9 @@ |
664 | 668 | */ |
665 | 669 | int ata_pci_prepare_native_host(struct pci_dev *pdev, |
666 | 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 | 673 | struct ata_host *host; |
670 | - unsigned int port_mask; | |
671 | 674 | int rc; |
672 | 675 | |
673 | 676 | if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) |
... | ... | @@ -681,11 +684,7 @@ |
681 | 684 | goto err_out; |
682 | 685 | } |
683 | 686 | |
684 | - port_mask = ATA_PORT_PRIMARY; | |
685 | - if (n_ports > 1) | |
686 | - port_mask |= ATA_PORT_SECONDARY; | |
687 | - | |
688 | - rc = ata_pci_init_native_host(host, port_mask); | |
687 | + rc = ata_pci_init_native_host(host); | |
689 | 688 | if (rc) |
690 | 689 | goto err_out; |
691 | 690 | |
692 | 691 | |
... | ... | @@ -777,8 +776,11 @@ |
777 | 776 | /* iomap cmd and ctl ports */ |
778 | 777 | legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8); |
779 | 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 | 782 | return -ENOMEM; |
783 | + } | |
782 | 784 | |
783 | 785 | /* init IO addresses */ |
784 | 786 | ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no]; |
785 | 787 | |
786 | 788 | |
787 | 789 | |
... | ... | @@ -792,19 +794,20 @@ |
792 | 794 | /** |
793 | 795 | * ata_init_legacy_host - acquire legacy ATA resources and init ATA host |
794 | 796 | * @host: target ATA host |
795 | - * @legacy_mask: out parameter, mask indicating ports is in legacy mode | |
796 | 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 | 803 | * LOCKING: |
801 | 804 | * Inherited from calling layer (may sleep). |
802 | 805 | * |
803 | 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, | |
807 | - unsigned int *legacy_mask, int *was_busy) | |
810 | +static int ata_init_legacy_host(struct ata_host *host, int *was_busy) | |
808 | 811 | { |
809 | 812 | struct device *gdev = host->dev; |
810 | 813 | struct ata_legacy_devres *legacy_dr; |
811 | 814 | |
812 | 815 | |
813 | 816 | |
... | ... | @@ -821,23 +824,24 @@ |
821 | 824 | devres_add(gdev, legacy_dr); |
822 | 825 | |
823 | 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 | 830 | rc = ata_init_legacy_port(host->ports[i], legacy_dr); |
826 | 831 | if (rc == 0) |
827 | 832 | legacy_dr->mask |= 1 << i; |
828 | - else if (rc == -EBUSY) | |
829 | - (*was_busy)++; | |
833 | + else { | |
834 | + if (rc == -EBUSY) | |
835 | + (*was_busy)++; | |
836 | + host->ports[i]->ops = &ata_dummy_port_ops; | |
837 | + } | |
830 | 838 | } |
831 | 839 | |
832 | - if (!legacy_dr->mask) | |
833 | - return -EBUSY; | |
840 | + if (!legacy_dr->mask) { | |
841 | + dev_printk(KERN_ERR, gdev, "no available legacy port\n"); | |
842 | + return -ENODEV; | |
843 | + } | |
834 | 844 | |
835 | - for (i = 0; i < 2; i++) | |
836 | - if (!(legacy_dr->mask & (1 << i))) | |
837 | - host->ports[i]->ops = &ata_dummy_port_ops; | |
838 | - | |
839 | - *legacy_mask |= legacy_dr->mask; | |
840 | - | |
841 | 845 | devres_remove_group(gdev, NULL); |
842 | 846 | return 0; |
843 | 847 | |
... | ... | @@ -875,7 +879,7 @@ |
875 | 879 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); |
876 | 880 | BUG_ON(!legacy_dr); |
877 | 881 | |
878 | - for (i = 0; i < host->n_ports; i++) { | |
882 | + for (i = 0; i < 2; i++) { | |
879 | 883 | unsigned int irq; |
880 | 884 | |
881 | 885 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ |
... | ... | @@ -923,8 +927,7 @@ |
923 | 927 | /** |
924 | 928 | * ata_pci_init_one - Initialize/register PCI IDE host controller |
925 | 929 | * @pdev: Controller to be initialized |
926 | - * @port_info: Information from low-level host driver | |
927 | - * @n_ports: Number of ports attached to host controller | |
930 | + * @ppi: array of port_info, must be enough for two ports | |
928 | 931 | * |
929 | 932 | * This is a helper function which can be called from a driver's |
930 | 933 | * xxx_init_one() probe function if the hardware uses traditional |
931 | 934 | |
932 | 935 | |
933 | 936 | |
934 | 937 | |
935 | 938 | |
... | ... | @@ -944,27 +947,35 @@ |
944 | 947 | * RETURNS: |
945 | 948 | * Zero on success, negative on errno-based value on error. |
946 | 949 | */ |
947 | - | |
948 | -int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |
949 | - unsigned int n_ports) | |
950 | +int ata_pci_init_one(struct pci_dev *pdev, | |
951 | + const struct ata_port_info * const * ppi) | |
950 | 952 | { |
951 | 953 | struct device *dev = &pdev->dev; |
954 | + const struct ata_port_info *pi = NULL; | |
952 | 955 | struct ata_host *host = NULL; |
953 | - const struct ata_port_info *port[2]; | |
954 | 956 | u8 mask; |
955 | - unsigned int legacy_mode = 0; | |
956 | - int rc; | |
957 | + int legacy_mode = 0; | |
958 | + int i, rc; | |
957 | 959 | |
958 | 960 | DPRINTK("ENTER\n"); |
959 | 961 | |
962 | + /* look up the first valid port_info */ | |
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 | + } | |
969 | + | |
970 | + if (!pi) { | |
971 | + dev_printk(KERN_ERR, &pdev->dev, | |
972 | + "no valid port_info specified\n"); | |
973 | + return -EINVAL; | |
974 | + } | |
975 | + | |
960 | 976 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) |
961 | 977 | return -ENOMEM; |
962 | 978 | |
963 | - BUG_ON(n_ports < 1 || n_ports > 2); | |
964 | - | |
965 | - port[0] = port_info[0]; | |
966 | - port[1] = (n_ports > 1) ? port_info[1] : NULL; | |
967 | - | |
968 | 979 | /* FIXME: Really for ATA it isn't safe because the device may be |
969 | 980 | multi-purpose and we want to leave it alone if it was already |
970 | 981 | enabled. Secondly for shared use as Arjan says we want refcounting |
... | ... | @@ -984,7 +995,7 @@ |
984 | 995 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); |
985 | 996 | mask = (1 << 2) | (1 << 0); |
986 | 997 | if ((tmp8 & mask) != mask) |
987 | - legacy_mode = (1 << 3); | |
998 | + legacy_mode = 1; | |
988 | 999 | #if defined(CONFIG_NO_ATA_LEGACY) |
989 | 1000 | /* Some platforms with PCI limits cannot address compat |
990 | 1001 | port space. In that case we punt if their firmware has |
... | ... | @@ -998,7 +1009,7 @@ |
998 | 1009 | } |
999 | 1010 | |
1000 | 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 | 1013 | if (!host) { |
1003 | 1014 | dev_printk(KERN_ERR, &pdev->dev, |
1004 | 1015 | "failed to allocate ATA host\n"); |
1005 | 1016 | |
... | ... | @@ -1007,19 +1018,13 @@ |
1007 | 1018 | } |
1008 | 1019 | |
1009 | 1020 | if (!legacy_mode) { |
1010 | - unsigned int port_mask; | |
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); | |
1021 | + rc = ata_pci_init_native_host(host); | |
1017 | 1022 | if (rc) |
1018 | 1023 | goto err_out; |
1019 | 1024 | } else { |
1020 | 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 | 1028 | if (was_busy) |
1024 | 1029 | pcim_pin_device(pdev); |
1025 | 1030 | if (rc) |
... | ... | @@ -1040,8 +1045,7 @@ |
1040 | 1045 | goto err_out; |
1041 | 1046 | |
1042 | 1047 | if (!legacy_mode) |
1043 | - rc = devm_request_irq(dev, pdev->irq, | |
1044 | - port_info[0]->port_ops->irq_handler, | |
1048 | + rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, | |
1045 | 1049 | IRQF_SHARED, DRV_NAME, host); |
1046 | 1050 | else { |
1047 | 1051 | irq_handler_t handler[2] = { host->ops->irq_handler, |
... | ... | @@ -1055,7 +1059,7 @@ |
1055 | 1059 | goto err_out; |
1056 | 1060 | |
1057 | 1061 | /* register */ |
1058 | - rc = ata_host_register(host, port_info[0]->sht); | |
1062 | + rc = ata_host_register(host, pi->sht); | |
1059 | 1063 | if (rc) |
1060 | 1064 | goto err_out; |
1061 | 1065 |
drivers/ata/pata_ali.c
... | ... | @@ -518,14 +518,14 @@ |
518 | 518 | |
519 | 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 | 522 | .sht = &ali_sht, |
523 | 523 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
524 | 524 | .pio_mask = 0x1f, |
525 | 525 | .port_ops = &ali_early_port_ops |
526 | 526 | }; |
527 | 527 | /* Revision 0x20 added DMA */ |
528 | - static struct ata_port_info info_20 = { | |
528 | + static const struct ata_port_info info_20 = { | |
529 | 529 | .sht = &ali_sht, |
530 | 530 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
531 | 531 | .pio_mask = 0x1f, |
... | ... | @@ -533,7 +533,7 @@ |
533 | 533 | .port_ops = &ali_20_port_ops |
534 | 534 | }; |
535 | 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 | 537 | .sht = &ali_sht, |
538 | 538 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
539 | 539 | .pio_mask = 0x1f, |
... | ... | @@ -542,7 +542,7 @@ |
542 | 542 | .port_ops = &ali_20_port_ops |
543 | 543 | }; |
544 | 544 | /* Revision 0xC2 adds UDMA66 */ |
545 | - static struct ata_port_info info_c2 = { | |
545 | + static const struct ata_port_info info_c2 = { | |
546 | 546 | .sht = &ali_sht, |
547 | 547 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
548 | 548 | .pio_mask = 0x1f, |
... | ... | @@ -551,7 +551,7 @@ |
551 | 551 | .port_ops = &ali_c2_port_ops |
552 | 552 | }; |
553 | 553 | /* Revision 0xC3 is UDMA100 */ |
554 | - static struct ata_port_info info_c3 = { | |
554 | + static const struct ata_port_info info_c3 = { | |
555 | 555 | .sht = &ali_sht, |
556 | 556 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
557 | 557 | .pio_mask = 0x1f, |
... | ... | @@ -560,7 +560,7 @@ |
560 | 560 | .port_ops = &ali_c2_port_ops |
561 | 561 | }; |
562 | 562 | /* Revision 0xC4 is UDMA133 */ |
563 | - static struct ata_port_info info_c4 = { | |
563 | + static const struct ata_port_info info_c4 = { | |
564 | 564 | .sht = &ali_sht, |
565 | 565 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
566 | 566 | .pio_mask = 0x1f, |
... | ... | @@ -569,7 +569,7 @@ |
569 | 569 | .port_ops = &ali_c2_port_ops |
570 | 570 | }; |
571 | 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 | 573 | .sht = &ali_sht, |
574 | 574 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
575 | 575 | .pio_mask = 0x1f, |
... | ... | @@ -578,7 +578,7 @@ |
578 | 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 | 582 | u8 rev, tmp; |
583 | 583 | struct pci_dev *isa_bridge; |
584 | 584 | |
585 | 585 | |
586 | 586 | |
587 | 587 | |
588 | 588 | |
589 | 589 | |
... | ... | @@ -590,17 +590,17 @@ |
590 | 590 | */ |
591 | 591 | |
592 | 592 | if (rev < 0x20) { |
593 | - port_info[0] = port_info[1] = &info_early; | |
593 | + ppi[0] = &info_early; | |
594 | 594 | } else if (rev < 0xC2) { |
595 | - port_info[0] = port_info[1] = &info_20; | |
595 | + ppi[0] = &info_20; | |
596 | 596 | } else if (rev == 0xC2) { |
597 | - port_info[0] = port_info[1] = &info_c2; | |
597 | + ppi[0] = &info_c2; | |
598 | 598 | } else if (rev == 0xC3) { |
599 | - port_info[0] = port_info[1] = &info_c3; | |
599 | + ppi[0] = &info_c3; | |
600 | 600 | } else if (rev == 0xC4) { |
601 | - port_info[0] = port_info[1] = &info_c4; | |
601 | + ppi[0] = &info_c4; | |
602 | 602 | } else |
603 | - port_info[0] = port_info[1] = &info_c5; | |
603 | + ppi[0] = &info_c5; | |
604 | 604 | |
605 | 605 | ali_init_chipset(pdev); |
606 | 606 | |
607 | 607 | |
... | ... | @@ -609,10 +609,10 @@ |
609 | 609 | /* Are we paired with a UDMA capable chip */ |
610 | 610 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); |
611 | 611 | if ((tmp & 0x1E) == 0x12) |
612 | - port_info[0] = port_info[1] = &info_20_udma; | |
612 | + ppi[0] = &info_20_udma; | |
613 | 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 | 618 | #ifdef CONFIG_PM |
drivers/ata/pata_amd.c
... | ... | @@ -538,7 +538,7 @@ |
538 | 538 | |
539 | 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 | 542 | { /* 0: AMD 7401 */ |
543 | 543 | .sht = &amd_sht, |
544 | 544 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
... | ... | @@ -620,7 +620,7 @@ |
620 | 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 | 624 | static int printed_version; |
625 | 625 | int type = id->driver_data; |
626 | 626 | u8 rev; |
... | ... | @@ -652,9 +652,8 @@ |
652 | 652 | ata_pci_clear_simplex(pdev); |
653 | 653 | |
654 | 654 | /* And fire it up */ |
655 | - | |
656 | - port_info[0] = port_info[1] = &info[type]; | |
657 | - return ata_pci_init_one(pdev, port_info, 2); | |
655 | + ppi[0] = &info[type]; | |
656 | + return ata_pci_init_one(pdev, ppi); | |
658 | 657 | } |
659 | 658 | |
660 | 659 | #ifdef CONFIG_PM |
drivers/ata/pata_artop.c
... | ... | @@ -414,7 +414,7 @@ |
414 | 414 | static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
415 | 415 | { |
416 | 416 | static int printed_version; |
417 | - static struct ata_port_info info_6210 = { | |
417 | + static const struct ata_port_info info_6210 = { | |
418 | 418 | .sht = &artop_sht, |
419 | 419 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
420 | 420 | .pio_mask = 0x1f, /* pio0-4 */ |
... | ... | @@ -422,7 +422,7 @@ |
422 | 422 | .udma_mask = ATA_UDMA2, |
423 | 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 | 426 | .sht = &artop_sht, |
427 | 427 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
428 | 428 | .pio_mask = 0x1f, /* pio0-4 */ |
... | ... | @@ -430,7 +430,7 @@ |
430 | 430 | .udma_mask = ATA_UDMA4, |
431 | 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 | 434 | .sht = &artop_sht, |
435 | 435 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
436 | 436 | .pio_mask = 0x1f, /* pio0-4 */ |
437 | 437 | |
438 | 438 | |
439 | 439 | |
440 | 440 | |
441 | 441 | |
... | ... | @@ -438,32 +438,30 @@ |
438 | 438 | .udma_mask = ATA_UDMA5, |
439 | 439 | .port_ops = &artop6260_ops, |
440 | 440 | }; |
441 | - struct ata_port_info *port_info[2]; | |
442 | - struct ata_port_info *info = NULL; | |
443 | - int ports = 2; | |
441 | + const struct ata_port_info *ppi[] = { NULL, NULL }; | |
444 | 442 | |
445 | 443 | if (!printed_version++) |
446 | 444 | dev_printk(KERN_DEBUG, &pdev->dev, |
447 | 445 | "version " DRV_VERSION "\n"); |
448 | 446 | |
449 | 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 | 450 | /* BIOS may have left us in UDMA, clear it before libata probe */ |
452 | 451 | pci_write_config_byte(pdev, 0x54, 0); |
453 | 452 | /* For the moment (also lacks dsc) */ |
454 | 453 | printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n"); |
455 | 454 | printk(KERN_WARNING "Secondary ATA ports will not be activated.\n"); |
456 | - ports = 1; | |
457 | 455 | } |
458 | 456 | else if (id->driver_data == 1) /* 6260 */ |
459 | - info = &info_626x; | |
457 | + ppi[0] = &info_626x; | |
460 | 458 | else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ |
461 | 459 | unsigned long io = pci_resource_start(pdev, 4); |
462 | 460 | u8 reg; |
463 | 461 | |
464 | - info = &info_626x; | |
462 | + ppi[0] = &info_626x; | |
465 | 463 | if (inb(io) & 0x10) |
466 | - info = &info_626x_fast; | |
464 | + ppi[0] = &info_626x_fast; | |
467 | 465 | /* Mac systems come up with some registers not set as we |
468 | 466 | will need them */ |
469 | 467 | |
470 | 468 | |
... | ... | @@ -484,10 +482,9 @@ |
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; | |
490 | - return ata_pci_init_one(pdev, port_info, ports); | |
487 | + return ata_pci_init_one(pdev, ppi); | |
491 | 488 | } |
492 | 489 | |
493 | 490 | static const struct pci_device_id artop_pci_tbl[] = { |
drivers/ata/pata_atiixp.c
... | ... | @@ -268,7 +268,7 @@ |
268 | 268 | |
269 | 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 | 272 | .sht = &atiixp_sht, |
273 | 273 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
274 | 274 | .pio_mask = 0x1f, |
... | ... | @@ -276,8 +276,8 @@ |
276 | 276 | .udma_mask = 0x3F, |
277 | 277 | .port_ops = &atiixp_port_ops |
278 | 278 | }; |
279 | - static struct ata_port_info *port_info[2] = { &info, &info }; | |
280 | - return ata_pci_init_one(dev, port_info, 2); | |
279 | + const struct ata_port_info *ppi[] = { &info, NULL }; | |
280 | + return ata_pci_init_one(dev, ppi); | |
281 | 281 | } |
282 | 282 | |
283 | 283 | static const struct pci_device_id atiixp[] = { |
drivers/ata/pata_cmd640.c
... | ... | @@ -249,17 +249,16 @@ |
249 | 249 | |
250 | 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 | 253 | .sht = &cmd640_sht, |
254 | 254 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
255 | 255 | .pio_mask = 0x1f, |
256 | 256 | .port_ops = &cmd640_port_ops |
257 | 257 | }; |
258 | + const struct ata_port_info *ppi[] = { &info, NULL }; | |
258 | 259 | |
259 | - static struct ata_port_info *port_info[2] = { &info, &info }; | |
260 | - | |
261 | 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 | 264 | static int cmd640_reinit_one(struct pci_dev *pdev) |
drivers/ata/pata_cmd64x.c
... | ... | @@ -377,7 +377,7 @@ |
377 | 377 | { |
378 | 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 | 381 | { /* CMD 643 - no UDMA */ |
382 | 382 | .sht = &cmd64x_sht, |
383 | 383 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
384 | 384 | |
... | ... | @@ -424,11 +424,9 @@ |
424 | 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 | 428 | u8 mrdmode; |
429 | 429 | |
430 | - info = &cmd_info[id->driver_data]; | |
431 | - | |
432 | 430 | pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); |
433 | 431 | class_rev &= 0xFF; |
434 | 432 | |
435 | 433 | |
... | ... | @@ -438,10 +436,10 @@ |
438 | 436 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { |
439 | 437 | /* Does UDMA work ? */ |
440 | 438 | if (class_rev > 4) |
441 | - info = &cmd_info[2]; | |
439 | + ppi[0] = &cmd_info[2]; | |
442 | 440 | /* Early rev with other problems ? */ |
443 | 441 | else if (class_rev == 1) |
444 | - info = &cmd_info[3]; | |
442 | + ppi[0] = &cmd_info[3]; | |
445 | 443 | } |
446 | 444 | |
447 | 445 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); |
... | ... | @@ -457,8 +455,7 @@ |
457 | 455 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); |
458 | 456 | #endif |
459 | 457 | |
460 | - port_info[0] = port_info[1] = info; | |
461 | - return ata_pci_init_one(pdev, port_info, 2); | |
458 | + return ata_pci_init_one(pdev, ppi); | |
462 | 459 | } |
463 | 460 | |
464 | 461 | #ifdef CONFIG_PM |
drivers/ata/pata_cs5530.c
... | ... | @@ -335,7 +335,7 @@ |
335 | 335 | |
336 | 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 | 339 | .sht = &cs5530_sht, |
340 | 340 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
341 | 341 | .pio_mask = 0x1f, |
342 | 342 | |
343 | 343 | |
344 | 344 | |
... | ... | @@ -344,23 +344,23 @@ |
344 | 344 | .port_ops = &cs5530_port_ops |
345 | 345 | }; |
346 | 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 | 348 | .sht = &cs5530_sht, |
349 | 349 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
350 | 350 | .pio_mask = 0x1f, |
351 | 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 | 355 | /* Chip initialisation */ |
356 | 356 | if (cs5530_init_chip()) |
357 | 357 | return -ENODEV; |
358 | 358 | |
359 | 359 | if (cs5530_is_palmax()) |
360 | - port_info[1] = &info_palmax_secondary; | |
360 | + ppi[1] = &info_palmax_secondary; | |
361 | 361 | |
362 | 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 | 366 | #ifdef CONFIG_PM |
drivers/ata/pata_cs5535.c
... | ... | @@ -223,7 +223,7 @@ |
223 | 223 | |
224 | 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 | 227 | .sht = &cs5535_sht, |
228 | 228 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
229 | 229 | .pio_mask = 0x1f, |
... | ... | @@ -231,7 +231,7 @@ |
231 | 231 | .udma_mask = 0x1f, |
232 | 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 | 236 | u32 timings, dummy; |
237 | 237 | |
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); |
244 | 244 | if (CS5535_BAD_PIO(timings)) |
245 | 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 | 249 | static const struct pci_device_id cs5535[] = { |
drivers/ata/pata_cypress.c
... | ... | @@ -165,14 +165,14 @@ |
165 | 165 | |
166 | 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 | 169 | .sht = &cy82c693_sht, |
170 | 170 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
171 | 171 | .pio_mask = 0x1f, |
172 | 172 | .mwdma_mask = 0x07, |
173 | 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 | 177 | /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. |
178 | 178 | For the moment we don't handle the secondary. FIXME */ |
... | ... | @@ -180,7 +180,7 @@ |
180 | 180 | if (PCI_FUNC(pdev->devfn) != 1) |
181 | 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 | 186 | static const struct pci_device_id cy82c693[] = { |
drivers/ata/pata_efar.c
... | ... | @@ -301,7 +301,7 @@ |
301 | 301 | static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
302 | 302 | { |
303 | 303 | static int printed_version; |
304 | - static struct ata_port_info info = { | |
304 | + static const struct ata_port_info info = { | |
305 | 305 | .sht = &efar_sht, |
306 | 306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
307 | 307 | .pio_mask = 0x1f, /* pio0-4 */ |
308 | 308 | |
... | ... | @@ -309,13 +309,13 @@ |
309 | 309 | .udma_mask = 0x0f, /* UDMA 66 */ |
310 | 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 | 314 | if (!printed_version++) |
315 | 315 | dev_printk(KERN_DEBUG, &pdev->dev, |
316 | 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 | 321 | static const struct pci_device_id efar_pci_tbl[] = { |
drivers/ata/pata_hpt366.c
... | ... | @@ -417,7 +417,7 @@ |
417 | 417 | |
418 | 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 | 421 | .sht = &hpt36x_sht, |
422 | 422 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
423 | 423 | .pio_mask = 0x1f, |
... | ... | @@ -425,7 +425,8 @@ |
425 | 425 | .udma_mask = 0x1f, |
426 | 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 | 431 | u32 class_rev; |
431 | 432 | u32 reg1; |
432 | 433 | |
433 | 434 | |
434 | 435 | |
... | ... | @@ -446,17 +447,17 @@ |
446 | 447 | /* info_hpt366 is safe against re-entry so we can scribble on it */ |
447 | 448 | switch((reg1 & 0x700) >> 8) { |
448 | 449 | case 5: |
449 | - info_hpt366.private_data = &hpt366_40; | |
450 | + info.private_data = &hpt366_40; | |
450 | 451 | break; |
451 | 452 | case 9: |
452 | - info_hpt366.private_data = &hpt366_25; | |
453 | + info.private_data = &hpt366_25; | |
453 | 454 | break; |
454 | 455 | default: |
455 | - info_hpt366.private_data = &hpt366_33; | |
456 | + info.private_data = &hpt366_33; | |
456 | 457 | break; |
457 | 458 | } |
458 | 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 | 463 | #ifdef CONFIG_PM |
drivers/ata/pata_hpt37x.c
... | ... | @@ -887,7 +887,7 @@ |
887 | 887 | static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
888 | 888 | { |
889 | 889 | /* HPT370 - UDMA100 */ |
890 | - static struct ata_port_info info_hpt370 = { | |
890 | + static const struct ata_port_info info_hpt370 = { | |
891 | 891 | .sht = &hpt37x_sht, |
892 | 892 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
893 | 893 | .pio_mask = 0x1f, |
... | ... | @@ -896,7 +896,7 @@ |
896 | 896 | .port_ops = &hpt370_port_ops |
897 | 897 | }; |
898 | 898 | /* HPT370A - UDMA100 */ |
899 | - static struct ata_port_info info_hpt370a = { | |
899 | + static const struct ata_port_info info_hpt370a = { | |
900 | 900 | .sht = &hpt37x_sht, |
901 | 901 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
902 | 902 | .pio_mask = 0x1f, |
... | ... | @@ -905,7 +905,7 @@ |
905 | 905 | .port_ops = &hpt370a_port_ops |
906 | 906 | }; |
907 | 907 | /* HPT370 - UDMA100 */ |
908 | - static struct ata_port_info info_hpt370_33 = { | |
908 | + static const struct ata_port_info info_hpt370_33 = { | |
909 | 909 | .sht = &hpt37x_sht, |
910 | 910 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
911 | 911 | .pio_mask = 0x1f, |
... | ... | @@ -914,7 +914,7 @@ |
914 | 914 | .port_ops = &hpt370_port_ops |
915 | 915 | }; |
916 | 916 | /* HPT370A - UDMA100 */ |
917 | - static struct ata_port_info info_hpt370a_33 = { | |
917 | + static const struct ata_port_info info_hpt370a_33 = { | |
918 | 918 | .sht = &hpt37x_sht, |
919 | 919 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
920 | 920 | .pio_mask = 0x1f, |
... | ... | @@ -923,7 +923,7 @@ |
923 | 923 | .port_ops = &hpt370a_port_ops |
924 | 924 | }; |
925 | 925 | /* HPT371, 372 and friends - UDMA133 */ |
926 | - static struct ata_port_info info_hpt372 = { | |
926 | + static const struct ata_port_info info_hpt372 = { | |
927 | 927 | .sht = &hpt37x_sht, |
928 | 928 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
929 | 929 | .pio_mask = 0x1f, |
... | ... | @@ -932,7 +932,7 @@ |
932 | 932 | .port_ops = &hpt372_port_ops |
933 | 933 | }; |
934 | 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 | 936 | .sht = &hpt37x_sht, |
937 | 937 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
938 | 938 | .pio_mask = 0x1f, |
... | ... | @@ -941,7 +941,7 @@ |
941 | 941 | .port_ops = &hpt372_port_ops |
942 | 942 | }; |
943 | 943 | /* HPT374 - UDMA133 */ |
944 | - static struct ata_port_info info_hpt374 = { | |
944 | + static const struct ata_port_info info_hpt374 = { | |
945 | 945 | .sht = &hpt37x_sht, |
946 | 946 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
947 | 947 | .pio_mask = 0x1f, |
948 | 948 | |
... | ... | @@ -951,10 +951,11 @@ |
951 | 951 | }; |
952 | 952 | |
953 | 953 | static const int MHz[4] = { 33, 40, 50, 66 }; |
954 | + const struct ata_port_info *port; | |
955 | + void *private_data = NULL; | |
956 | + struct ata_port_info port_info; | |
957 | + const struct ata_port_info *ppi[] = { &port_info, NULL }; | |
954 | 958 | |
955 | - struct ata_port_info *port_info[2]; | |
956 | - struct ata_port_info *port; | |
957 | - | |
958 | 959 | u8 irqmask; |
959 | 960 | u32 class_rev; |
960 | 961 | u8 mcr1; |
961 | 962 | |
962 | 963 | |
... | ... | @@ -1124,13 +1125,13 @@ |
1124 | 1125 | return -ENODEV; |
1125 | 1126 | } |
1126 | 1127 | if (clock_slot == 3) |
1127 | - port->private_data = (void *)hpt37x_timings_66; | |
1128 | + private_data = (void *)hpt37x_timings_66; | |
1128 | 1129 | else |
1129 | - port->private_data = (void *)hpt37x_timings_50; | |
1130 | + private_data = (void *)hpt37x_timings_50; | |
1130 | 1131 | |
1131 | 1132 | printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); |
1132 | 1133 | } else { |
1133 | - port->private_data = (void *)chip_table->clocks[clock_slot]; | |
1134 | + private_data = (void *)chip_table->clocks[clock_slot]; | |
1134 | 1135 | /* |
1135 | 1136 | * Perform a final fixup. Note that we will have used the |
1136 | 1137 | * DPLL on the HPT372 which means we don't have to worry |
1137 | 1138 | |
... | ... | @@ -1144,9 +1145,11 @@ |
1144 | 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 | 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 | 1155 | static const struct pci_device_id hpt37x[] = { |
drivers/ata/pata_hpt3x2n.c
... | ... | @@ -488,7 +488,7 @@ |
488 | 488 | static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
489 | 489 | { |
490 | 490 | /* HPT372N and friends - UDMA133 */ |
491 | - static struct ata_port_info info = { | |
491 | + static const struct ata_port_info info = { | |
492 | 492 | .sht = &hpt3x2n_sht, |
493 | 493 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
494 | 494 | .pio_mask = 0x1f, |
... | ... | @@ -496,8 +496,8 @@ |
496 | 496 | .udma_mask = 0x7f, |
497 | 497 | .port_ops = &hpt3x2n_port_ops |
498 | 498 | }; |
499 | - struct ata_port_info *port_info[2]; | |
500 | - struct ata_port_info *port = &info; | |
499 | + struct ata_port_info port = info; | |
500 | + const struct ata_port_info *ppi[] = { &port, NULL }; | |
501 | 501 | |
502 | 502 | u8 irqmask; |
503 | 503 | u32 class_rev; |
504 | 504 | |
... | ... | @@ -585,9 +585,9 @@ |
585 | 585 | |
586 | 586 | /* Set our private data up. We only need a few flags so we use |
587 | 587 | it directly */ |
588 | - port->private_data = NULL; | |
588 | + port.private_data = NULL; | |
589 | 589 | if (pci_mhz > 60) { |
590 | - port->private_data = (void *)PCI66; | |
590 | + port.private_data = (void *)PCI66; | |
591 | 591 | /* |
592 | 592 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in |
593 | 593 | * the MISC. register to stretch the UltraDMA Tss timing. |
... | ... | @@ -598,8 +598,7 @@ |
598 | 598 | } |
599 | 599 | |
600 | 600 | /* Now kick off ATA set up */ |
601 | - port_info[0] = port_info[1] = port; | |
602 | - return ata_pci_init_one(dev, port_info, 2); | |
601 | + return ata_pci_init_one(dev, ppi); | |
603 | 602 | } |
604 | 603 | |
605 | 604 | static const struct pci_device_id hpt3x2n[] = { |
drivers/ata/pata_hpt3x3.c
... | ... | @@ -171,7 +171,7 @@ |
171 | 171 | |
172 | 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 | 175 | .sht = &hpt3x3_sht, |
176 | 176 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
177 | 177 | .pio_mask = 0x1f, |
178 | 178 | |
... | ... | @@ -179,11 +179,11 @@ |
179 | 179 | .udma_mask = 0x07, |
180 | 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 | 184 | hpt3x3_init_chipset(dev); |
185 | 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 | 189 | #ifdef CONFIG_PM |
drivers/ata/pata_it8213.c
... | ... | @@ -311,7 +311,7 @@ |
311 | 311 | static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
312 | 312 | { |
313 | 313 | static int printed_version; |
314 | - static struct ata_port_info info = { | |
314 | + static const struct ata_port_info info = { | |
315 | 315 | .sht = &it8213_sht, |
316 | 316 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
317 | 317 | .pio_mask = 0x1f, /* pio0-4 */ |
318 | 318 | |
... | ... | @@ -319,14 +319,14 @@ |
319 | 319 | .udma_mask = 0x1f, /* UDMA 100 */ |
320 | 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 | 325 | if (!printed_version++) |
325 | 326 | dev_printk(KERN_DEBUG, &pdev->dev, |
326 | 327 | "version " DRV_VERSION "\n"); |
327 | 328 | |
328 | - /* Current IT8213 stuff is single port */ | |
329 | - return ata_pci_init_one(pdev, port_info, 1); | |
329 | + return ata_pci_init_one(pdev, ppi); | |
330 | 330 | } |
331 | 331 | |
332 | 332 | static const struct pci_device_id it8213_pci_tbl[] = { |
drivers/ata/pata_it821x.c
... | ... | @@ -718,14 +718,14 @@ |
718 | 718 | { |
719 | 719 | u8 conf; |
720 | 720 | |
721 | - static struct ata_port_info info_smart = { | |
721 | + static const struct ata_port_info info_smart = { | |
722 | 722 | .sht = &it821x_sht, |
723 | 723 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
724 | 724 | .pio_mask = 0x1f, |
725 | 725 | .mwdma_mask = 0x07, |
726 | 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 | 729 | .sht = &it821x_sht, |
730 | 730 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
731 | 731 | .pio_mask = 0x1f, |
732 | 732 | |
... | ... | @@ -733,8 +733,8 @@ |
733 | 733 | .udma_mask = 0x7f, |
734 | 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 | 738 | static char *mode[2] = { "pass through", "smart" }; |
739 | 739 | |
740 | 740 | /* Force the card into bypass mode if so requested */ |
741 | 741 | |
742 | 742 | |
... | ... | @@ -747,11 +747,11 @@ |
747 | 747 | |
748 | 748 | printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); |
749 | 749 | if (conf == 0) |
750 | - port_info[0] = port_info[1] = &info_passthru; | |
750 | + ppi[0] = &info_passthru; | |
751 | 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 | 757 | #ifdef CONFIG_PM |
drivers/ata/pata_jmicron.c
... | ... | @@ -191,7 +191,7 @@ |
191 | 191 | |
192 | 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 | 195 | .sht = &jmicron_sht, |
196 | 196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
197 | 197 | |
198 | 198 | |
... | ... | @@ -201,9 +201,9 @@ |
201 | 201 | |
202 | 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 | 209 | static const struct pci_device_id jmicron_pci_tbl[] = { |
drivers/ata/pata_marvell.c
... | ... | @@ -161,7 +161,7 @@ |
161 | 161 | |
162 | 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 | 165 | .sht = &marvell_sht, |
166 | 166 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
167 | 167 | |
... | ... | @@ -171,7 +171,7 @@ |
171 | 171 | |
172 | 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 | 175 | .sht = &marvell_sht, |
176 | 176 | /* Slave possible as its magically mapped not real */ |
177 | 177 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
178 | 178 | |
179 | 179 | |
... | ... | @@ -182,13 +182,12 @@ |
182 | 182 | |
183 | 183 | .port_ops = &marvell_ops, |
184 | 184 | }; |
185 | - struct ata_port_info *port_info[2] = { &info, &info_sata }; | |
186 | - int n_port = 2; | |
185 | + const struct ata_port_info *ppi[] = { &info, &info_sata }; | |
187 | 186 | |
188 | 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 | 193 | static const struct pci_device_id marvell_pci_tbl[] = { |
drivers/ata/pata_netcell.c
... | ... | @@ -92,7 +92,7 @@ |
92 | 92 | static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
93 | 93 | { |
94 | 94 | static int printed_version; |
95 | - static struct ata_port_info info = { | |
95 | + static const struct ata_port_info info = { | |
96 | 96 | .sht = &netcell_sht, |
97 | 97 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
98 | 98 | /* Actually we don't really care about these as the |
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | .udma_mask = 0x3f, /* UDMA 133 */ |
103 | 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 | 107 | if (!printed_version++) |
108 | 108 | dev_printk(KERN_DEBUG, &pdev->dev, |
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 | ata_pci_clear_simplex(pdev); |
113 | 113 | |
114 | 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 | 118 | static const struct pci_device_id netcell_pci_tbl[] = { |
drivers/ata/pata_ns87410.c
... | ... | @@ -191,14 +191,14 @@ |
191 | 191 | |
192 | 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 | 195 | .sht = &ns87410_sht, |
196 | 196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
197 | 197 | .pio_mask = 0x0F, |
198 | 198 | .port_ops = &ns87410_port_ops |
199 | 199 | }; |
200 | - static struct ata_port_info *port_info[2] = {&info, &info}; | |
201 | - return ata_pci_init_one(dev, port_info, 2); | |
200 | + const struct ata_port_info *ppi[] = { &info, NULL }; | |
201 | + return ata_pci_init_one(dev, ppi); | |
202 | 202 | } |
203 | 203 | |
204 | 204 | static const struct pci_device_id ns87410[] = { |
drivers/ata/pata_oldpiix.c
... | ... | @@ -289,20 +289,20 @@ |
289 | 289 | static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
290 | 290 | { |
291 | 291 | static int printed_version; |
292 | - static struct ata_port_info info = { | |
292 | + static const struct ata_port_info info = { | |
293 | 293 | .sht = &oldpiix_sht, |
294 | 294 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
295 | 295 | .pio_mask = 0x1f, /* pio0-4 */ |
296 | 296 | .mwdma_mask = 0x07, /* mwdma1-2 */ |
297 | 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 | 301 | if (!printed_version++) |
302 | 302 | dev_printk(KERN_DEBUG, &pdev->dev, |
303 | 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 | 308 | static const struct pci_device_id oldpiix_pci_tbl[] = { |
drivers/ata/pata_opti.c
... | ... | @@ -216,19 +216,19 @@ |
216 | 216 | |
217 | 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 | 220 | .sht = &opti_sht, |
221 | 221 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
222 | 222 | .pio_mask = 0x1f, |
223 | 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 | 226 | static int printed_version; |
227 | 227 | |
228 | 228 | if (!printed_version++) |
229 | 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 | 234 | static const struct pci_device_id opti[] = { |
drivers/ata/pata_optidma.c
... | ... | @@ -482,14 +482,14 @@ |
482 | 482 | |
483 | 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 | 486 | .sht = &optidma_sht, |
487 | 487 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
488 | 488 | .pio_mask = 0x1f, |
489 | 489 | .mwdma_mask = 0x07, |
490 | 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 | 493 | .sht = &optidma_sht, |
494 | 494 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
495 | 495 | .pio_mask = 0x1f, |
... | ... | @@ -497,8 +497,7 @@ |
497 | 497 | .udma_mask = 0x07, |
498 | 498 | .port_ops = &optiplus_port_ops |
499 | 499 | }; |
500 | - static struct ata_port_info *port_info[2]; | |
501 | - struct ata_port_info *info = &info_82c700; | |
500 | + const struct ata_port_info *ppi[] = { &info_82c700, NULL }; | |
502 | 501 | static int printed_version; |
503 | 502 | |
504 | 503 | if (!printed_version++) |
505 | 504 | |
... | ... | @@ -510,10 +509,9 @@ |
510 | 509 | pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ |
511 | 510 | |
512 | 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; | |
516 | - return ata_pci_init_one(dev, port_info, 2); | |
514 | + return ata_pci_init_one(dev, ppi); | |
517 | 515 | } |
518 | 516 | |
519 | 517 | static const struct pci_device_id optidma[] = { |
drivers/ata/pata_pdc202xx_old.c
... | ... | @@ -317,7 +317,7 @@ |
317 | 317 | |
318 | 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 | 322 | .sht = &pdc202xx_sht, |
323 | 323 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
324 | 324 | |
... | ... | @@ -344,10 +344,8 @@ |
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 | 348 | |
349 | - port_info[0] = port_info[1] = &info[id->driver_data]; | |
350 | - | |
351 | 349 | if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { |
352 | 350 | struct pci_dev *bridge = dev->bus->self; |
353 | 351 | /* Don't grab anything behind a Promise I2O RAID */ |
... | ... | @@ -358,7 +356,7 @@ |
358 | 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 | 362 | static const struct pci_device_id pdc202xx[] = { |
drivers/ata/pata_radisys.c
... | ... | @@ -255,7 +255,7 @@ |
255 | 255 | static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
256 | 256 | { |
257 | 257 | static int printed_version; |
258 | - static struct ata_port_info info = { | |
258 | + static const struct ata_port_info info = { | |
259 | 259 | .sht = &radisys_sht, |
260 | 260 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
261 | 261 | .pio_mask = 0x1f, /* pio0-4 */ |
262 | 262 | |
... | ... | @@ -263,13 +263,13 @@ |
263 | 263 | .udma_mask = 0x14, /* UDMA33/66 only */ |
264 | 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 | 268 | if (!printed_version++) |
269 | 269 | dev_printk(KERN_DEBUG, &pdev->dev, |
270 | 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 | 275 | static const struct pci_device_id radisys_pci_tbl[] = { |
drivers/ata/pata_rz1000.c
... | ... | @@ -131,22 +131,20 @@ |
131 | 131 | static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
132 | 132 | { |
133 | 133 | static int printed_version; |
134 | - struct ata_port_info *port_info[2]; | |
135 | - static struct ata_port_info info = { | |
134 | + static const struct ata_port_info info = { | |
136 | 135 | .sht = &rz1000_sht, |
137 | 136 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
138 | 137 | .pio_mask = 0x1f, |
139 | 138 | .port_ops = &rz1000_port_ops |
140 | 139 | }; |
140 | + const struct ata_port_info *ppi[] = { &info, NULL }; | |
141 | 141 | |
142 | 142 | if (!printed_version++) |
143 | 143 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); |
144 | 144 | |
145 | - if (rz1000_fifo_disable(pdev) == 0) { | |
146 | - port_info[0] = &info; | |
147 | - port_info[1] = &info; | |
148 | - return ata_pci_init_one(pdev, port_info, 2); | |
149 | - } | |
145 | + if (rz1000_fifo_disable(pdev) == 0) | |
146 | + return ata_pci_init_one(pdev, ppi); | |
147 | + | |
150 | 148 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); |
151 | 149 | /* Not safe to use so skip */ |
152 | 150 | return -ENODEV; |
drivers/ata/pata_sc1200.c
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | |
244 | 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 | 247 | .sht = &sc1200_sht, |
248 | 248 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
249 | 249 | .pio_mask = 0x1f, |
250 | 250 | |
... | ... | @@ -251,10 +251,10 @@ |
251 | 251 | .udma_mask = 0x07, |
252 | 252 | .port_ops = &sc1200_port_ops |
253 | 253 | }; |
254 | - static struct ata_port_info *port_info[2] = { &info, &info }; | |
255 | - | |
256 | 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 | 260 | static const struct pci_device_id sc1200[] = { |
drivers/ata/pata_serverworks.c
... | ... | @@ -475,8 +475,7 @@ |
475 | 475 | |
476 | 476 | static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
477 | 477 | { |
478 | - int ports = 2; | |
479 | - static struct ata_port_info info[4] = { | |
478 | + static const struct ata_port_info info[4] = { | |
480 | 479 | { /* OSB4 */ |
481 | 480 | .sht = &serverworks_sht, |
482 | 481 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
... | ... | @@ -507,8 +506,7 @@ |
507 | 506 | .port_ops = &serverworks_csb_port_ops |
508 | 507 | } |
509 | 508 | }; |
510 | - static struct ata_port_info *port_info[2]; | |
511 | - struct ata_port_info *devinfo = &info[id->driver_data]; | |
509 | + const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; | |
512 | 510 | |
513 | 511 | /* Force master latency timer to 64 PCI clocks */ |
514 | 512 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); |
... | ... | @@ -517,7 +515,7 @@ |
517 | 515 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
518 | 516 | /* Select non UDMA capable OSB4 if we can't do fixups */ |
519 | 517 | if ( serverworks_fixup_osb4(pdev) < 0) |
520 | - devinfo = &info[1]; | |
518 | + ppi[0] = &info[1]; | |
521 | 519 | } |
522 | 520 | /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ |
523 | 521 | else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || |
524 | 522 | |
... | ... | @@ -527,11 +525,11 @@ |
527 | 525 | /* If the returned btr is the newer revision then |
528 | 526 | select the right info block */ |
529 | 527 | if (serverworks_fixup_csb(pdev) == 3) |
530 | - devinfo = &info[3]; | |
528 | + ppi[0] = &info[3]; | |
531 | 529 | |
532 | 530 | /* Is this the 3rd channel CSB6 IDE ? */ |
533 | 531 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) |
534 | - ports = 1; | |
532 | + ppi[1] = &ata_dummy_port_info; | |
535 | 533 | } |
536 | 534 | /* setup HT1000E */ |
537 | 535 | else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) |
... | ... | @@ -540,8 +538,7 @@ |
540 | 538 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
541 | 539 | ata_pci_clear_simplex(pdev); |
542 | 540 | |
543 | - port_info[0] = port_info[1] = devinfo; | |
544 | - return ata_pci_init_one(pdev, port_info, ports); | |
541 | + return ata_pci_init_one(pdev, ppi); | |
545 | 542 | } |
546 | 543 | |
547 | 544 | #ifdef CONFIG_PM |
drivers/ata/pata_sil680.c
... | ... | @@ -341,7 +341,7 @@ |
341 | 341 | |
342 | 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 | 345 | .sht = &sil680_sht, |
346 | 346 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
347 | 347 | .pio_mask = 0x1f, |
... | ... | @@ -349,7 +349,7 @@ |
349 | 349 | .udma_mask = 0x7f, |
350 | 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 | 353 | .sht = &sil680_sht, |
354 | 354 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
355 | 355 | .pio_mask = 0x1f, |
... | ... | @@ -357,7 +357,7 @@ |
357 | 357 | .udma_mask = 0x3f, |
358 | 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 | 361 | static int printed_version; |
362 | 362 | |
363 | 363 | if (!printed_version++) |
364 | 364 | |
... | ... | @@ -366,12 +366,12 @@ |
366 | 366 | switch(sil680_init_chip(pdev)) |
367 | 367 | { |
368 | 368 | case 0: |
369 | - port_info[0] = port_info[1] = &info_slow; | |
369 | + ppi[0] = &info_slow; | |
370 | 370 | break; |
371 | 371 | case 0x30: |
372 | 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 | 377 | #ifdef CONFIG_PM |
drivers/ata/pata_sis.c
... | ... | @@ -38,8 +38,8 @@ |
38 | 38 | #define DRV_VERSION "0.5.1" |
39 | 39 | |
40 | 40 | struct sis_chipset { |
41 | - u16 device; /* PCI host ID */ | |
42 | - struct ata_port_info *info; /* Info block */ | |
41 | + u16 device; /* PCI host ID */ | |
42 | + const struct ata_port_info *info; /* Info block */ | |
43 | 43 | /* Probably add family, cable detect type etc here to clean |
44 | 44 | up code later */ |
45 | 45 | }; |
... | ... | @@ -696,7 +696,7 @@ |
696 | 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 | 700 | .sht = &sis_sht, |
701 | 701 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
702 | 702 | .pio_mask = 0x1f, /* pio0-4 */ |
... | ... | @@ -704,7 +704,7 @@ |
704 | 704 | .udma_mask = 0, |
705 | 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 | 708 | .sht = &sis_sht, |
709 | 709 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
710 | 710 | .pio_mask = 0x1f, /* pio0-4 */ |
711 | 711 | |
712 | 712 | |
713 | 713 | |
714 | 714 | |
... | ... | @@ -712,35 +712,35 @@ |
712 | 712 | .udma_mask = ATA_UDMA2, /* UDMA 33 */ |
713 | 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 | 716 | .sht = &sis_sht, |
717 | 717 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
718 | 718 | .pio_mask = 0x1f, /* pio0-4 */ |
719 | 719 | .udma_mask = ATA_UDMA4, /* UDMA 66 */ |
720 | 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 | 723 | .sht = &sis_sht, |
724 | 724 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
725 | 725 | .pio_mask = 0x1f, /* pio0-4 */ |
726 | 726 | .udma_mask = ATA_UDMA5, |
727 | 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 | 730 | .sht = &sis_sht, |
731 | 731 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
732 | 732 | .udma_mask = ATA_UDMA5, |
733 | 733 | .pio_mask = 0x1f, /* pio0-4 */ |
734 | 734 | .port_ops = &sis_66_ops, |
735 | 735 | }; |
736 | -struct ata_port_info sis_info133 = { | |
736 | +const struct ata_port_info sis_info133 = { | |
737 | 737 | .sht = &sis_sht, |
738 | 738 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
739 | 739 | .pio_mask = 0x1f, /* pio0-4 */ |
740 | 740 | .udma_mask = ATA_UDMA6, |
741 | 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 | 744 | .sht = &sis_sht, |
745 | 745 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
746 | 746 | .pio_mask = 0x1f, /* pio0-4 */ |
... | ... | @@ -823,8 +823,8 @@ |
823 | 823 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
824 | 824 | { |
825 | 825 | static int printed_version; |
826 | - static struct ata_port_info *port_info[2]; | |
827 | - struct ata_port_info *port; | |
826 | + struct ata_port_info port; | |
827 | + const struct ata_port_info *ppi[] = { &port, NULL }; | |
828 | 828 | struct pci_dev *host = NULL; |
829 | 829 | struct sis_chipset *chipset = NULL; |
830 | 830 | struct sis_chipset *sets; |
831 | 831 | |
... | ... | @@ -964,13 +964,12 @@ |
964 | 964 | if (chipset == NULL) |
965 | 965 | return -ENODEV; |
966 | 966 | |
967 | - port = chipset->info; | |
968 | - port->private_data = chipset; | |
967 | + port = *chipset->info; | |
968 | + port.private_data = chipset; | |
969 | 969 | |
970 | 970 | sis_fixup(pdev, chipset); |
971 | 971 | |
972 | - port_info[0] = port_info[1] = port; | |
973 | - return ata_pci_init_one(pdev, port_info, 2); | |
972 | + return ata_pci_init_one(pdev, ppi); | |
974 | 973 | } |
975 | 974 | |
976 | 975 | static const struct pci_device_id sis_pci_tbl[] = { |
drivers/ata/pata_sl82c105.c
... | ... | @@ -301,20 +301,22 @@ |
301 | 301 | |
302 | 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 | 305 | .sht = &sl82c105_sht, |
306 | 306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
307 | 307 | .pio_mask = 0x1f, |
308 | 308 | .mwdma_mask = 0x07, |
309 | 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 | 312 | .sht = &sl82c105_sht, |
313 | 313 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
314 | 314 | .pio_mask = 0x1f, |
315 | 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 | 320 | u32 val; |
319 | 321 | int rev; |
320 | 322 | |
321 | 323 | |
... | ... | @@ -324,17 +326,14 @@ |
324 | 326 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); |
325 | 327 | else if (rev <= 5) |
326 | 328 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); |
327 | - else { | |
328 | - port_info[0] = &info_dma; | |
329 | - port_info[1] = &info_dma; | |
330 | - } | |
329 | + else | |
330 | + ppi[0] = &info_dma; | |
331 | 331 | |
332 | 332 | pci_read_config_dword(dev, 0x40, &val); |
333 | 333 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; |
334 | 334 | pci_write_config_dword(dev, 0x40, val); |
335 | 335 | |
336 | - | |
337 | - return ata_pci_init_one(dev, port_info, 1); /* For now */ | |
336 | + return ata_pci_init_one(dev, ppi); | |
338 | 337 | } |
339 | 338 | |
340 | 339 | static const struct pci_device_id sl82c105[] = { |
drivers/ata/pata_triflex.c
... | ... | @@ -233,20 +233,20 @@ |
233 | 233 | |
234 | 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 | 237 | .sht = &triflex_sht, |
238 | 238 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
239 | 239 | .pio_mask = 0x1f, |
240 | 240 | .mwdma_mask = 0x07, |
241 | 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 | 244 | static int printed_version; |
245 | 245 | |
246 | 246 | if (!printed_version++) |
247 | 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 | 252 | static const struct pci_device_id triflex[] = { |
drivers/ata/pata_via.c
... | ... | @@ -421,7 +421,7 @@ |
421 | 421 | static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
422 | 422 | { |
423 | 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 | 425 | .sht = &via_sht, |
426 | 426 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
427 | 427 | .pio_mask = 0x1f, |
... | ... | @@ -429,7 +429,7 @@ |
429 | 429 | .port_ops = &via_port_ops |
430 | 430 | }; |
431 | 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 | 433 | .sht = &via_sht, |
434 | 434 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
435 | 435 | .pio_mask = 0x1f, |
... | ... | @@ -437,7 +437,7 @@ |
437 | 437 | .port_ops = &via_port_ops_noirq, |
438 | 438 | }; |
439 | 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 | 441 | .sht = &via_sht, |
442 | 442 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
443 | 443 | .pio_mask = 0x1f, |
... | ... | @@ -446,7 +446,7 @@ |
446 | 446 | .port_ops = &via_port_ops |
447 | 447 | }; |
448 | 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 | 450 | .sht = &via_sht, |
451 | 451 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
452 | 452 | .pio_mask = 0x1f, |
... | ... | @@ -455,7 +455,7 @@ |
455 | 455 | .port_ops = &via_port_ops |
456 | 456 | }; |
457 | 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 | 459 | .sht = &via_sht, |
460 | 460 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
461 | 461 | .pio_mask = 0x1f, |
... | ... | @@ -464,7 +464,7 @@ |
464 | 464 | .port_ops = &via_port_ops |
465 | 465 | }; |
466 | 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 | 468 | .sht = &via_sht, |
469 | 469 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
470 | 470 | .pio_mask = 0x1f, |
... | ... | @@ -472,7 +472,8 @@ |
472 | 472 | .udma_mask = 0x7f, /* FIXME: should check north bridge */ |
473 | 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 | 477 | struct pci_dev *isa = NULL; |
477 | 478 | const struct via_isa_bridge *config; |
478 | 479 | static int printed_version; |
479 | 480 | |
480 | 481 | |
481 | 482 | |
482 | 483 | |
483 | 484 | |
... | ... | @@ -517,25 +518,25 @@ |
517 | 518 | switch(config->flags & VIA_UDMA) { |
518 | 519 | case VIA_UDMA_NONE: |
519 | 520 | if (config->flags & VIA_NO_UNMASK) |
520 | - type = &via_mwdma_info_borked; | |
521 | + type = via_mwdma_info_borked; | |
521 | 522 | else |
522 | - type = &via_mwdma_info; | |
523 | + type = via_mwdma_info; | |
523 | 524 | break; |
524 | 525 | case VIA_UDMA_33: |
525 | - type = &via_udma33_info; | |
526 | + type = via_udma33_info; | |
526 | 527 | break; |
527 | 528 | case VIA_UDMA_66: |
528 | - type = &via_udma66_info; | |
529 | + type = via_udma66_info; | |
529 | 530 | /* The 66 MHz devices require we enable the clock */ |
530 | 531 | pci_read_config_dword(pdev, 0x50, &timing); |
531 | 532 | timing |= 0x80008; |
532 | 533 | pci_write_config_dword(pdev, 0x50, timing); |
533 | 534 | break; |
534 | 535 | case VIA_UDMA_100: |
535 | - type = &via_udma100_info; | |
536 | + type = via_udma100_info; | |
536 | 537 | break; |
537 | 538 | case VIA_UDMA_133: |
538 | - type = &via_udma133_info; | |
539 | + type = via_udma133_info; | |
539 | 540 | break; |
540 | 541 | default: |
541 | 542 | WARN_ON(1); |
542 | 543 | |
... | ... | @@ -550,10 +551,9 @@ |
550 | 551 | } |
551 | 552 | |
552 | 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, port_info, 2); | |
556 | + return ata_pci_init_one(pdev, ppi); | |
557 | 557 | } |
558 | 558 | |
559 | 559 | #ifdef CONFIG_PM |
drivers/ata/sata_nv.c
... | ... | @@ -457,7 +457,7 @@ |
457 | 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 | 461 | /* generic */ |
462 | 462 | { |
463 | 463 | .sht = &nv_sht, |
... | ... | @@ -1537,7 +1537,7 @@ |
1537 | 1537 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
1538 | 1538 | { |
1539 | 1539 | static int printed_version = 0; |
1540 | - const struct ata_port_info *ppi[2]; | |
1540 | + const struct ata_port_info *ppi[] = { NULL, NULL }; | |
1541 | 1541 | struct ata_host *host; |
1542 | 1542 | struct nv_host_priv *hpriv; |
1543 | 1543 | int rc; |
... | ... | @@ -1565,8 +1565,8 @@ |
1565 | 1565 | type = ADMA; |
1566 | 1566 | } |
1567 | 1567 | |
1568 | - ppi[0] = ppi[1] = &nv_port_info[type]; | |
1569 | - rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | |
1568 | + ppi[0] = &nv_port_info[type]; | |
1569 | + rc = ata_pci_prepare_native_host(pdev, ppi, &host); | |
1570 | 1570 | if (rc) |
1571 | 1571 | return rc; |
1572 | 1572 |
drivers/ata/sata_sis.c
... | ... | @@ -129,7 +129,7 @@ |
129 | 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 | 133 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
134 | 134 | .pio_mask = 0x1f, |
135 | 135 | .mwdma_mask = 0x7, |
... | ... | @@ -255,7 +255,7 @@ |
255 | 255 | { |
256 | 256 | static int printed_version; |
257 | 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 | 259 | struct ata_host *host; |
260 | 260 | u32 genctl, val; |
261 | 261 | u8 pmr; |
... | ... | @@ -335,7 +335,7 @@ |
335 | 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 | 339 | if (rc) |
340 | 340 | return rc; |
341 | 341 |
drivers/ata/sata_uli.c
... | ... | @@ -125,7 +125,7 @@ |
125 | 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 | 129 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
130 | 130 | ATA_FLAG_IGN_SIMPLEX, |
131 | 131 | .pio_mask = 0x1f, /* pio0-4 */ |
132 | 132 | |
133 | 133 | |
134 | 134 | |
... | ... | @@ -201,19 +201,33 @@ |
201 | 201 | n_ports = 2; |
202 | 202 | if (board_idx == uli_5287) |
203 | 203 | n_ports = 4; |
204 | - rc = ata_pci_prepare_native_host(pdev, ppi, n_ports, &host); | |
205 | - if (rc) | |
206 | - return rc; | |
207 | 204 | |
205 | + /* allocate the host */ | |
206 | + host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); | |
207 | + if (!host) | |
208 | + return -ENOMEM; | |
209 | + | |
208 | 210 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); |
209 | 211 | if (!hpriv) |
210 | 212 | return -ENOMEM; |
211 | 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 | 224 | iomap = host->iomap; |
214 | 225 | |
215 | 226 | switch (board_idx) { |
216 | 227 | case uli_5287: |
228 | + /* If there are four, the last two live right after | |
229 | + * the standard SFF ports. | |
230 | + */ | |
217 | 231 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; |
218 | 232 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; |
219 | 233 |
drivers/ata/sata_via.c
drivers/ata/sis.h
include/linux/libata.h
... | ... | @@ -253,10 +253,6 @@ |
253 | 253 | ATA_DMA_PAD_SZ = 4, |
254 | 254 | ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, |
255 | 255 | |
256 | - /* masks for port functions */ | |
257 | - ATA_PORT_PRIMARY = (1 << 0), | |
258 | - ATA_PORT_SECONDARY = (1 << 1), | |
259 | - | |
260 | 256 | /* ering size */ |
261 | 257 | ATA_ERING_SIZE = 32, |
262 | 258 | |
... | ... | @@ -688,8 +684,8 @@ |
688 | 684 | extern void ata_port_disable(struct ata_port *); |
689 | 685 | extern void ata_std_ports(struct ata_ioports *ioaddr); |
690 | 686 | #ifdef CONFIG_PCI |
691 | -extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |
692 | - unsigned int n_ports); | |
687 | +extern int ata_pci_init_one (struct pci_dev *pdev, | |
688 | + const struct ata_port_info * const * ppi); | |
693 | 689 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
694 | 690 | #ifdef CONFIG_PM |
695 | 691 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
696 | 692 | |
... | ... | @@ -854,11 +850,11 @@ |
854 | 850 | unsigned long val; |
855 | 851 | }; |
856 | 852 | |
857 | -extern int ata_pci_init_native_host(struct ata_host *host, | |
858 | - unsigned int port_mask); | |
853 | +extern int ata_pci_init_native_host(struct ata_host *host); | |
854 | +extern int ata_pci_init_bmdma(struct ata_host *host); | |
859 | 855 | extern int ata_pci_prepare_native_host(struct pci_dev *pdev, |
860 | 856 | const struct ata_port_info * const * ppi, |
861 | - int n_ports, struct ata_host **r_host); | |
857 | + struct ata_host **r_host); | |
862 | 858 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
863 | 859 | extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); |
864 | 860 | #endif /* CONFIG_PCI */ |