diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-sff.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 10ee22ae5c15..623cec914c9b 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1027,13 +1027,15 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1027 | #endif | 1027 | #endif |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | rc = pci_request_regions(pdev, DRV_NAME); | 1030 | if (!legacy_mode) { |
1031 | if (rc) { | 1031 | rc = pci_request_regions(pdev, DRV_NAME); |
1032 | disable_dev_on_err = 0; | 1032 | if (rc) { |
1033 | goto err_out; | 1033 | disable_dev_on_err = 0; |
1034 | } | 1034 | goto err_out; |
1035 | 1035 | } | |
1036 | if (legacy_mode) { | 1036 | } else { |
1037 | /* Deal with combined mode hack. This side of the logic all | ||
1038 | goes away once the combined mode hack is killed in 2.6.21 */ | ||
1037 | if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) { | 1039 | if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) { |
1038 | struct resource *conflict, res; | 1040 | struct resource *conflict, res; |
1039 | res.start = ATA_PRIMARY_CMD; | 1041 | res.start = ATA_PRIMARY_CMD; |
@@ -1071,6 +1073,13 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1071 | } | 1073 | } |
1072 | } else | 1074 | } else |
1073 | legacy_mode |= ATA_PORT_SECONDARY; | 1075 | legacy_mode |= ATA_PORT_SECONDARY; |
1076 | |||
1077 | if (legacy_mode & ATA_PORT_PRIMARY) | ||
1078 | pci_request_region(pdev, 1, DRV_NAME); | ||
1079 | if (legacy_mode & ATA_PORT_SECONDARY) | ||
1080 | pci_request_region(pdev, 3, DRV_NAME); | ||
1081 | /* If there is a DMA resource, allocate it */ | ||
1082 | pci_request_region(pdev, 4, DRV_NAME); | ||
1074 | } | 1083 | } |
1075 | 1084 | ||
1076 | /* we have legacy mode, but all ports are unavailable */ | 1085 | /* we have legacy mode, but all ports are unavailable */ |
@@ -1114,11 +1123,20 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1114 | err_out_ent: | 1123 | err_out_ent: |
1115 | kfree(probe_ent); | 1124 | kfree(probe_ent); |
1116 | err_out_regions: | 1125 | err_out_regions: |
1117 | if (legacy_mode & ATA_PORT_PRIMARY) | 1126 | /* All this conditional stuff is needed for the combined mode hack |
1118 | release_region(ATA_PRIMARY_CMD, 8); | 1127 | until 2.6.21 when it can go */ |
1119 | if (legacy_mode & ATA_PORT_SECONDARY) | 1128 | if (legacy_mode) { |
1120 | release_region(ATA_SECONDARY_CMD, 8); | 1129 | pci_release_region(pdev, 4); |
1121 | pci_release_regions(pdev); | 1130 | if (legacy_mode & ATA_PORT_PRIMARY) { |
1131 | release_region(ATA_PRIMARY_CMD, 8); | ||
1132 | pci_release_region(pdev, 1); | ||
1133 | } | ||
1134 | if (legacy_mode & ATA_PORT_SECONDARY) { | ||
1135 | release_region(ATA_SECONDARY_CMD, 8); | ||
1136 | pci_release_region(pdev, 3); | ||
1137 | } | ||
1138 | } else | ||
1139 | pci_release_regions(pdev); | ||
1122 | err_out: | 1140 | err_out: |
1123 | if (disable_dev_on_err) | 1141 | if (disable_dev_on_err) |
1124 | pci_disable_device(pdev); | 1142 | pci_disable_device(pdev); |