libata: ATA_EHI_LPM should be ATA_EH_LPM
[sfrench/cifs-2.6.git] / drivers / ata / libata-core.c
index 4fbcce758b04deb227729ebd6b445009cb37777a..48519887f94a021caa2e91e9287ad1db491e9c29 100644 (file)
@@ -106,7 +106,8 @@ static struct ata_force_ent *ata_force_tbl;
 static int ata_force_tbl_size;
 
 static char ata_force_param_buf[PAGE_SIZE] __initdata;
-module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0444);
+/* param_buf is thrown away after initialization, disallow read */
+module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0);
 MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)");
 
 int atapi_enabled = 1;
@@ -971,7 +972,7 @@ static void ata_dev_disable_pm(struct ata_device *dev)
 void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
 {
        ap->pm_policy = policy;
-       ap->link.eh_info.action |= ATA_EHI_LPM;
+       ap->link.eh_info.action |= ATA_EH_LPM;
        ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY;
        ata_port_schedule_eh(ap);
 }
@@ -1415,12 +1416,12 @@ static int ata_hpa_resize(struct ata_device *dev)
        /* read native max address */
        rc = ata_read_native_max_address(dev, &native_sectors);
        if (rc) {
-               /* If HPA isn't going to be unlocked, skip HPA
-                * resizing from the next try.
+               /* If device aborted the command or HPA isn't going to
+                * be unlocked, skip HPA resizing.
                 */
-               if (!ata_ignore_hpa) {
+               if (rc == -EACCES || !ata_ignore_hpa) {
                        ata_dev_printk(dev, KERN_WARNING, "HPA support seems "
-                                      "broken, will skip HPA handling\n");
+                                      "broken, skipping HPA handling\n");
                        dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
 
                        /* we can continue if device aborted the command */
@@ -1719,7 +1720,7 @@ void ata_port_flush_task(struct ata_port *ap)
        cancel_rearming_delayed_work(&ap->port_task);
 
        if (ata_msg_ctl(ap))
-               ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __FUNCTION__);
+               ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__);
 }
 
 static void ata_qc_complete_internal(struct ata_queued_cmd *qc)
@@ -2056,7 +2057,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
        int rc;
 
        if (ata_msg_ctl(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
+               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
 
        ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */
  retry:
@@ -2091,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;
@@ -2253,12 +2264,12 @@ int ata_dev_configure(struct ata_device *dev)
 
        if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
                ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n",
-                              __FUNCTION__);
+                              __func__);
                return 0;
        }
 
        if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
+               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
 
        /* set horkage */
        dev->horkage |= ata_dev_blacklisted(dev);
@@ -2279,7 +2290,7 @@ int ata_dev_configure(struct ata_device *dev)
                ata_dev_printk(dev, KERN_DEBUG,
                               "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x "
                               "85:%04x 86:%04x 87:%04x 88:%04x\n",
-                              __FUNCTION__,
+                              __func__,
                               id[49], id[82], id[83], id[84],
                               id[85], id[86], id[87], id[88]);
 
@@ -2511,13 +2522,13 @@ int ata_dev_configure(struct ata_device *dev)
 
        if (ata_msg_probe(ap))
                ata_dev_printk(dev, KERN_DEBUG, "%s: EXIT, drv_stat = 0x%x\n",
-                       __FUNCTION__, ata_chk_status(ap));
+                       __func__, ata_chk_status(ap));
        return 0;
 
 err_out_nosup:
        if (ata_msg_probe(ap))
                ata_dev_printk(dev, KERN_DEBUG,
-                              "%s: EXIT, err\n", __FUNCTION__);
+                              "%s: EXIT, err\n", __func__);
        return rc;
 }