فهرست منبع

libata: unify mechanism to request follow-up SRST

Previously, there were two ways to trigger follow-up SRST from
hardreset method - returning -EAGAIN and leaving all device classes
unmodified.  Drivers never used the latter mechanism and the only use
case for the former was when hardreset couldn't classify.

Drop the latter mechanism and let -EAGAIN mean "perform follow-up SRST
if classification is required".  This change removes unnecessary
follow-up SRSTs and simplifies reset implementations.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Tejun Heo 17 سال پیش
والد
کامیت
305d2a1ab1
4فایلهای تغییر یافته به همراه8 افزوده شده و 23 حذف شده
  1. 0 3
      drivers/ata/ahci.c
  2. 0 1
      drivers/ata/libata-core.c
  3. 8 18
      drivers/ata/libata-eh.c
  4. 0 1
      drivers/ata/libata-sff.c

+ 0 - 3
drivers/ata/ahci.c

@@ -1365,7 +1365,6 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
 
 
 	ahci_start_engine(ap);
 	ahci_start_engine(ap);
 
 
-	*class = ATA_DEV_NONE;
 	if (online)
 	if (online)
 		*class = ahci_dev_classify(ap);
 		*class = ahci_dev_classify(ap);
 
 
@@ -1394,7 +1393,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
 	/* vt8251 doesn't clear BSY on signature FIS reception,
 	/* vt8251 doesn't clear BSY on signature FIS reception,
 	 * request follow-up softreset.
 	 * request follow-up softreset.
 	 */
 	 */
-	*class = ATA_DEV_NONE;
 	return online ? -EAGAIN : rc;
 	return online ? -EAGAIN : rc;
 }
 }
 
 
@@ -1439,7 +1437,6 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
 		if (rc)
 		if (rc)
 			ahci_kick_engine(ap, 0);
 			ahci_kick_engine(ap, 0);
 	}
 	}
-	*class = ATA_DEV_NONE;
 	return rc;
 	return rc;
 }
 }
 
 

+ 0 - 1
drivers/ata/libata-core.c

@@ -3701,7 +3701,6 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,
 
 
 	/* do hardreset */
 	/* do hardreset */
 	rc = sata_link_hardreset(link, timing, deadline, &online, NULL);
 	rc = sata_link_hardreset(link, timing, deadline, &online, NULL);
-	*class = ATA_DEV_NONE;
 	return online ? -EAGAIN : rc;
 	return online ? -EAGAIN : rc;
 }
 }
 
 

+ 8 - 18
drivers/ata/libata-eh.c

@@ -2055,20 +2055,10 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
 	if (rc)
 	if (rc)
 		return rc;
 		return rc;
 
 
-	/* If any class isn't ATA_DEV_UNKNOWN, consider classification
-	 * is complete and convert all ATA_DEV_UNKNOWN to
-	 * ATA_DEV_NONE.
-	 */
+	/* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
 	ata_link_for_each_dev(dev, link)
 	ata_link_for_each_dev(dev, link)
-		if (classes[dev->devno] != ATA_DEV_UNKNOWN)
-			break;
-
-	if (dev) {
-		ata_link_for_each_dev(dev, link) {
-			if (classes[dev->devno] == ATA_DEV_UNKNOWN)
-				classes[dev->devno] = ATA_DEV_NONE;
-		}
-	}
+		if (classes[dev->devno] == ATA_DEV_UNKNOWN)
+			classes[dev->devno] = ATA_DEV_NONE;
 
 
 	return 0;
 	return 0;
 }
 }
@@ -2079,15 +2069,15 @@ static int ata_eh_followup_srst_needed(struct ata_link *link,
 {
 {
 	if (link->flags & ATA_LFLAG_NO_SRST)
 	if (link->flags & ATA_LFLAG_NO_SRST)
 		return 0;
 		return 0;
-	if (rc == -EAGAIN)
-		return 1;
+	if (rc == -EAGAIN) {
+		if (classify)
+			return 1;
+		rc = 0;
+	}
 	if (rc != 0)
 	if (rc != 0)
 		return 0;
 		return 0;
 	if ((link->ap->flags & ATA_FLAG_PMP) && ata_is_host_link(link))
 	if ((link->ap->flags & ATA_FLAG_PMP) && ata_is_host_link(link))
 		return 1;
 		return 1;
-	if (classify && !(link->flags & ATA_LFLAG_ASSUME_CLASS) &&
-	    classes[0] == ATA_DEV_UNKNOWN)
-		return 1;
 	return 0;
 	return 0;
 }
 }
 
 

+ 0 - 1
drivers/ata/libata-sff.c

@@ -1929,7 +1929,6 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
 
 
 	rc = sata_link_hardreset(link, timing, deadline, &online,
 	rc = sata_link_hardreset(link, timing, deadline, &online,
 				 ata_sff_check_ready);
 				 ata_sff_check_ready);
-	*class = ATA_DEV_NONE;
 	if (online)
 	if (online)
 		*class = ata_sff_dev_classify(link->device, 1, NULL);
 		*class = ata_sff_dev_classify(link->device, 1, NULL);