浏览代码

[PATCH] libata: implement ATA_EHI_RESUME_LINK

Implement ATA_EHI_RESUME_LINK, which indicates that the link needs to
be resumed.  This used to be implied by ATA_EHI_HOTPLUGGED.  However,
hotplug isn't the only event which requires link resume and separating
this out allows other places to request link resume.  This
differentiation also allows better debounce timing selection.

This patch converts user scan to use ATA_EHI_RESUME_LINK.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Tejun Heo 19 年之前
父节点
当前提交
2832430435
共有 3 个文件被更改,包括 11 次插入8 次删除
  1. 8 7
      drivers/scsi/libata-core.c
  2. 1 0
      drivers/scsi/libata-scsi.c
  3. 2 1
      include/linux/libata.h

+ 8 - 7
drivers/scsi/libata-core.c

@@ -2627,13 +2627,14 @@ int ata_std_prereset(struct ata_port *ap)
 	const unsigned long *timing;
 	const unsigned long *timing;
 	int rc;
 	int rc;
 
 
-	/* hotplug? */
-	if (ehc->i.flags & ATA_EHI_HOTPLUGGED) {
-		if (ap->flags & ATA_FLAG_HRST_TO_RESUME)
-			ehc->i.action |= ATA_EH_HARDRESET;
-		if (ap->flags & ATA_FLAG_SKIP_D2H_BSY)
-			ata_wait_spinup(ap);
-	}
+	/* handle link resume & hotplug spinup */
+	if ((ehc->i.flags & ATA_EHI_RESUME_LINK) &&
+	    (ap->flags & ATA_FLAG_HRST_TO_RESUME))
+		ehc->i.action |= ATA_EH_HARDRESET;
+
+	if ((ehc->i.flags & ATA_EHI_HOTPLUGGED) &&
+	    (ap->flags & ATA_FLAG_SKIP_D2H_BSY))
+		ata_wait_spinup(ap);
 
 
 	/* if we're about to do hardreset, nothing more to do */
 	/* if we're about to do hardreset, nothing more to do */
 	if (ehc->i.action & ATA_EH_HARDRESET)
 	if (ehc->i.action & ATA_EH_HARDRESET)

+ 1 - 0
drivers/scsi/libata-scsi.c

@@ -3011,6 +3011,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
 		if (dev) {
 		if (dev) {
 			ap->eh_info.probe_mask |= 1 << dev->devno;
 			ap->eh_info.probe_mask |= 1 << dev->devno;
 			ap->eh_info.action |= ATA_EH_SOFTRESET;
 			ap->eh_info.action |= ATA_EH_SOFTRESET;
+			ap->eh_info.flags |= ATA_EHI_RESUME_LINK;
 		} else
 		} else
 			rc = -EINVAL;
 			rc = -EINVAL;
 	}
 	}

+ 2 - 1
include/linux/libata.h

@@ -259,6 +259,7 @@ enum {
 
 
 	/* ata_eh_info->flags */
 	/* ata_eh_info->flags */
 	ATA_EHI_HOTPLUGGED	= (1 << 0),  /* could have been hotplugged */
 	ATA_EHI_HOTPLUGGED	= (1 << 0),  /* could have been hotplugged */
+	ATA_EHI_RESUME_LINK	= (1 << 1),  /* need to resume link */
 
 
 	ATA_EHI_DID_RESET	= (1 << 16), /* already reset this port */
 	ATA_EHI_DID_RESET	= (1 << 16), /* already reset this port */
 
 
@@ -836,7 +837,7 @@ static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
 	if (ehi->flags & ATA_EHI_HOTPLUGGED)
 	if (ehi->flags & ATA_EHI_HOTPLUGGED)
 		return;
 		return;
 
 
-	ehi->flags |= ATA_EHI_HOTPLUGGED;
+	ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK;
 	ehi->hotplug_timestamp = jiffies;
 	ehi->hotplug_timestamp = jiffies;
 
 
 	ehi->err_mask |= AC_ERR_ATA_BUS;
 	ehi->err_mask |= AC_ERR_ATA_BUS;