]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/libata-core.c
libata: assume no device is attached if both IDENTIFYs are aborted
[linux-2.6-omap-h63xx.git] / drivers / ata / libata-core.c
index 4bbe31f98ef8cffadb53a8c2b0962a8ac6f2c1bb..c9c52803d0c25217b48efb87de6c52a25136edb4 100644 (file)
@@ -2092,24 +2092,34 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
                                     id, sizeof(id[0]) * ATA_ID_WORDS, 0);
        if (err_mask) {
                if (err_mask & AC_ERR_NODEV_HINT) {
-                       DPRINTK("ata%u.%d: NODEV after polling detection\n",
-                               ap->print_id, dev->devno);
+                       ata_dev_printk(dev, KERN_DEBUG,
+                                      "NODEV after polling detection\n");
                        return -ENOENT;
                }
 
-               /* Device or controller might have reported the wrong
-                * device class.  Give a shot at the other IDENTIFY if
-                * the current one is aborted by the device.
-                */
-               if (may_fallback &&
-                   (err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) {
-                       may_fallback = 0;
+               if ((err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) {
+                       /* Device or controller might have reported
+                        * the wrong device class.  Give a shot at the
+                        * other IDENTIFY if the current one is
+                        * aborted by the device.
+                        */
+                       if (may_fallback) {
+                               may_fallback = 0;
 
-                       if (class == ATA_DEV_ATA)
-                               class = ATA_DEV_ATAPI;
-                       else
-                               class = ATA_DEV_ATA;
-                       goto retry;
+                               if (class == ATA_DEV_ATA)
+                                       class = ATA_DEV_ATAPI;
+                               else
+                                       class = ATA_DEV_ATA;
+                               goto retry;
+                       }
+
+                       /* Control reaches here iff the device aborted
+                        * both flavors of IDENTIFYs which happens
+                        * sometimes with phantom devices.
+                        */
+                       ata_dev_printk(dev, KERN_DEBUG,
+                                      "both IDENTIFYs aborted, assuming NODEV\n");
+                       return -ENOENT;
                }
 
                rc = -EIO;