提交 2044470c 编写于 作者: T Tejun Heo 提交者: Jeff Garzik

[PATCH] libata: fix class handling in ata_bus_probe()

ata_bus_probe() didn't set classes[] properly for port disabled case
of ->phy_reset() compatibility path.  This patch moves classes[]
initialization and normalization out of ->probe_reset block such that
it applies to both ->probe_reset and ->phy_reset paths.
Signed-off-by: NTejun Heo <htejun@gmail.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 4b10e559
...@@ -1344,32 +1344,30 @@ static int ata_bus_probe(struct ata_port *ap) ...@@ -1344,32 +1344,30 @@ static int ata_bus_probe(struct ata_port *ap)
ata_port_probe(ap); ata_port_probe(ap);
/* reset */ /* reset and determine device classes */
if (ap->ops->probe_reset) { for (i = 0; i < ATA_MAX_DEVICES; i++)
for (i = 0; i < ATA_MAX_DEVICES; i++) classes[i] = ATA_DEV_UNKNOWN;
classes[i] = ATA_DEV_UNKNOWN;
if (ap->ops->probe_reset) {
rc = ap->ops->probe_reset(ap, classes); rc = ap->ops->probe_reset(ap, classes);
if (rc) { if (rc) {
printk("ata%u: reset failed (errno=%d)\n", ap->id, rc); printk("ata%u: reset failed (errno=%d)\n", ap->id, rc);
return rc; return rc;
} }
for (i = 0; i < ATA_MAX_DEVICES; i++)
if (classes[i] == ATA_DEV_UNKNOWN)
classes[i] = ATA_DEV_NONE;
} else { } else {
ap->ops->phy_reset(ap); ap->ops->phy_reset(ap);
for (i = 0; i < ATA_MAX_DEVICES; i++) { if (!(ap->flags & ATA_FLAG_PORT_DISABLED))
if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) for (i = 0; i < ATA_MAX_DEVICES; i++)
classes[i] = ap->device[i].class; classes[i] = ap->device[i].class;
else
ap->device[i].class = ATA_DEV_UNKNOWN;
}
ata_port_probe(ap); ata_port_probe(ap);
} }
for (i = 0; i < ATA_MAX_DEVICES; i++)
if (classes[i] == ATA_DEV_UNKNOWN)
classes[i] = ATA_DEV_NONE;
/* read IDENTIFY page and configure devices */ /* 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];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册