ata_std_softreset() sometimes reports presence of dev 1 even when it doesn't exist (PCS-wise). This usually happens reading dev 1's signature returns that of dev 0 (e.g. on ICH6M). This patch turns off non-existent device on such cases. Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> --- drivers/scsi/ata_piix.c | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) cda8686b4ad82a9272748af4388d47475c6acb2b diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 72e38e6..625db11 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c @@ -566,14 +566,31 @@ static unsigned int piix_sata_probe (str */ static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes) { - if (!piix_sata_probe(ap)) { + unsigned int mask; + int i, rc; + + mask = piix_sata_probe(ap); + if (!mask) { printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id); return 0; } - return ata_drive_probe_reset(ap, ata_std_probeinit, - ata_std_softreset, NULL, - ata_std_postreset, classes); + rc = ata_drive_probe_reset(ap, ata_std_probeinit, + ata_std_softreset, NULL, + ata_std_postreset, classes); + if (rc) + return rc; + + for (i = 0; i < 2; i++) { + if (ata_class_present(classes[i]) && !(mask & (1 << i))) { + printk(KERN_WARNING "ata%u: dev %u class %d for " + "non-existent device, fixing up\n", + ap->id, i, classes[i]); + classes[i] = ATA_DEV_NONE; + } + } + + return 0; } /** -- 1.2.1 - : send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html