diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 10803f72c57d..b710fc480740 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1211,35 +1211,40 @@ err_out_nosup: | |||
1211 | 1211 | ||
1212 | static int ata_bus_probe(struct ata_port *ap) | 1212 | static int ata_bus_probe(struct ata_port *ap) |
1213 | { | 1213 | { |
1214 | unsigned int i, found = 0; | 1214 | unsigned int classes[ATA_MAX_DEVICES]; |
1215 | unsigned int i, rc, found = 0; | ||
1215 | 1216 | ||
1216 | if (ap->ops->probe_reset) { | 1217 | ata_port_probe(ap); |
1217 | unsigned int classes[ATA_MAX_DEVICES]; | ||
1218 | int rc; | ||
1219 | |||
1220 | ata_port_probe(ap); | ||
1221 | 1218 | ||
1219 | /* reset */ | ||
1220 | if (ap->ops->probe_reset) { | ||
1222 | rc = ap->ops->probe_reset(ap, classes); | 1221 | rc = ap->ops->probe_reset(ap, classes); |
1223 | if (rc == 0) { | 1222 | if (rc) { |
1224 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 1223 | printk("ata%u: reset failed (errno=%d)\n", ap->id, rc); |
1225 | if (classes[i] == ATA_DEV_UNKNOWN) | 1224 | return rc; |
1226 | classes[i] = ATA_DEV_NONE; | ||
1227 | ap->device[i].class = classes[i]; | ||
1228 | } | ||
1229 | } else { | ||
1230 | printk(KERN_ERR "ata%u: probe reset failed, " | ||
1231 | "disabling port\n", ap->id); | ||
1232 | ata_port_disable(ap); | ||
1233 | } | 1225 | } |
1234 | } else | 1226 | |
1227 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
1228 | if (classes[i] == ATA_DEV_UNKNOWN) | ||
1229 | classes[i] = ATA_DEV_NONE; | ||
1230 | } else { | ||
1235 | ap->ops->phy_reset(ap); | 1231 | ap->ops->phy_reset(ap); |
1236 | 1232 | ||
1237 | if (ap->flags & ATA_FLAG_PORT_DISABLED) | 1233 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
1238 | goto err_out; | 1234 | if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) |
1235 | classes[i] = ap->device[i].class; | ||
1236 | else | ||
1237 | ap->device[i].class = ATA_DEV_UNKNOWN; | ||
1238 | } | ||
1239 | ata_port_probe(ap); | ||
1240 | } | ||
1239 | 1241 | ||
1242 | /* read IDENTIFY page and configure devices */ | ||
1240 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 1243 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
1241 | struct ata_device *dev = &ap->device[i]; | 1244 | struct ata_device *dev = &ap->device[i]; |
1242 | 1245 | ||
1246 | dev->class = classes[i]; | ||
1247 | |||
1243 | if (!ata_dev_present(dev)) | 1248 | if (!ata_dev_present(dev)) |
1244 | continue; | 1249 | continue; |
1245 | 1250 | ||
@@ -1257,7 +1262,7 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1257 | found = 1; | 1262 | found = 1; |
1258 | } | 1263 | } |
1259 | 1264 | ||
1260 | if ((!found) || (ap->flags & ATA_FLAG_PORT_DISABLED)) | 1265 | if (!found) |
1261 | goto err_out_disable; | 1266 | goto err_out_disable; |
1262 | 1267 | ||
1263 | ata_set_mode(ap); | 1268 | ata_set_mode(ap); |
@@ -1268,7 +1273,6 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1268 | 1273 | ||
1269 | err_out_disable: | 1274 | err_out_disable: |
1270 | ap->ops->port_disable(ap); | 1275 | ap->ops->port_disable(ap); |
1271 | err_out: | ||
1272 | return -1; | 1276 | return -1; |
1273 | } | 1277 | } |
1274 | 1278 | ||