Commit 28ca5c57 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

[PATCH] libata: reorganize ata_bus_probe()

Now that reset and configure are converted such that they don't modify
or disable libata core data structures, reorganize ata_bus_probe() to
reflect this change.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 4b2f3ede
...@@ -1211,35 +1211,40 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev) ...@@ -1211,35 +1211,40 @@ static int ata_dev_configure(struct ata_port *ap, struct ata_device *dev)
static int ata_bus_probe(struct ata_port *ap) static int ata_bus_probe(struct ata_port *ap)
{ {
unsigned int i, found = 0;
if (ap->ops->probe_reset) {
unsigned int classes[ATA_MAX_DEVICES]; unsigned int classes[ATA_MAX_DEVICES];
int rc; unsigned int i, rc, found = 0;
ata_port_probe(ap); ata_port_probe(ap);
/* reset */
if (ap->ops->probe_reset) {
rc = ap->ops->probe_reset(ap, classes); rc = ap->ops->probe_reset(ap, classes);
if (rc == 0) { if (rc) {
for (i = 0; i < ATA_MAX_DEVICES; i++) { printk("ata%u: reset failed (errno=%d)\n", ap->id, rc);
return rc;
}
for (i = 0; i < ATA_MAX_DEVICES; i++)
if (classes[i] == ATA_DEV_UNKNOWN) if (classes[i] == ATA_DEV_UNKNOWN)
classes[i] = ATA_DEV_NONE; classes[i] = ATA_DEV_NONE;
ap->device[i].class = classes[i];
}
} else { } else {
printk(KERN_ERR "ata%u: probe reset failed, "
"disabling port\n", ap->id);
ata_port_disable(ap);
}
} else
ap->ops->phy_reset(ap); ap->ops->phy_reset(ap);
if (ap->flags & ATA_FLAG_PORT_DISABLED) for (i = 0; i < ATA_MAX_DEVICES; i++) {
goto err_out; if (!(ap->flags & ATA_FLAG_PORT_DISABLED))
classes[i] = ap->device[i].class;
else
ap->device[i].class = ATA_DEV_UNKNOWN;
}
ata_port_probe(ap);
}
/* read IDENTIFY page and configure devices */
for (i = 0; i < ATA_MAX_DEVICES; i++) { for (i = 0; i < ATA_MAX_DEVICES; i++) {
struct ata_device *dev = &ap->device[i]; struct ata_device *dev = &ap->device[i];
dev->class = classes[i];
if (!ata_dev_present(dev)) if (!ata_dev_present(dev))
continue; continue;
...@@ -1257,7 +1262,7 @@ static int ata_bus_probe(struct ata_port *ap) ...@@ -1257,7 +1262,7 @@ static int ata_bus_probe(struct ata_port *ap)
found = 1; found = 1;
} }
if ((!found) || (ap->flags & ATA_FLAG_PORT_DISABLED)) if (!found)
goto err_out_disable; goto err_out_disable;
ata_set_mode(ap); ata_set_mode(ap);
...@@ -1268,7 +1273,6 @@ static int ata_bus_probe(struct ata_port *ap) ...@@ -1268,7 +1273,6 @@ static int ata_bus_probe(struct ata_port *ap)
err_out_disable: err_out_disable:
ap->ops->port_disable(ap); ap->ops->port_disable(ap);
err_out:
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment