aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-04-07 09:47:20 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:23 -0400
commit305d2a1ab137d11d573319c315748a87060fe82d (patch)
tree8dcf81b1742db21c6a745688de96a18944c83617 /drivers/ata
parent5958e3025fd9d97429163e074d9cfa3848f51f28 (diff)
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>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c3
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/ata/libata-eh.c26
-rw-r--r--drivers/ata/libata-sff.c1
4 files changed, 8 insertions, 23 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index a69bcca4eb1b..3071a2341be3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1365,7 +1365,6 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
1365 1365
1366 ahci_start_engine(ap); 1366 ahci_start_engine(ap);
1367 1367
1368 *class = ATA_DEV_NONE;
1369 if (online) 1368 if (online)
1370 *class = ahci_dev_classify(ap); 1369 *class = ahci_dev_classify(ap);
1371 1370
@@ -1394,7 +1393,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
1394 /* vt8251 doesn't clear BSY on signature FIS reception, 1393 /* vt8251 doesn't clear BSY on signature FIS reception,
1395 * request follow-up softreset. 1394 * request follow-up softreset.
1396 */ 1395 */
1397 *class = ATA_DEV_NONE;
1398 return online ? -EAGAIN : rc; 1396 return online ? -EAGAIN : rc;
1399} 1397}
1400 1398
@@ -1439,7 +1437,6 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
1439 if (rc) 1437 if (rc)
1440 ahci_kick_engine(ap, 0); 1438 ahci_kick_engine(ap, 0);
1441 } 1439 }
1442 *class = ATA_DEV_NONE;
1443 return rc; 1440 return rc;
1444} 1441}
1445 1442
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2da579b46bdd..51876b93c1b7 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3701,7 +3701,6 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,
3701 3701
3702 /* do hardreset */ 3702 /* do hardreset */
3703 rc = sata_link_hardreset(link, timing, deadline, &online, NULL); 3703 rc = sata_link_hardreset(link, timing, deadline, &online, NULL);
3704 *class = ATA_DEV_NONE;
3705 return online ? -EAGAIN : rc; 3704 return online ? -EAGAIN : rc;
3706} 3705}
3707 3706
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d8c4a45dcf26..4ec1397434c0 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2055,20 +2055,10 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
2055 if (rc) 2055 if (rc)
2056 return rc; 2056 return rc;
2057 2057
2058 /* If any class isn't ATA_DEV_UNKNOWN, consider classification 2058 /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
2059 * is complete and convert all ATA_DEV_UNKNOWN to
2060 * ATA_DEV_NONE.
2061 */
2062 ata_link_for_each_dev(dev, link) 2059 ata_link_for_each_dev(dev, link)
2063 if (classes[dev->devno] != ATA_DEV_UNKNOWN) 2060 if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2064 break; 2061 classes[dev->devno] = ATA_DEV_NONE;
2065
2066 if (dev) {
2067 ata_link_for_each_dev(dev, link) {
2068 if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2069 classes[dev->devno] = ATA_DEV_NONE;
2070 }
2071 }
2072 2062
2073 return 0; 2063 return 0;
2074} 2064}
@@ -2079,15 +2069,15 @@ static int ata_eh_followup_srst_needed(struct ata_link *link,
2079{ 2069{
2080 if (link->flags & ATA_LFLAG_NO_SRST) 2070 if (link->flags & ATA_LFLAG_NO_SRST)
2081 return 0; 2071 return 0;
2082 if (rc == -EAGAIN) 2072 if (rc == -EAGAIN) {
2083 return 1; 2073 if (classify)
2074 return 1;
2075 rc = 0;
2076 }
2084 if (rc != 0) 2077 if (rc != 0)
2085 return 0; 2078 return 0;
2086 if ((link->ap->flags & ATA_FLAG_PMP) && ata_is_host_link(link)) 2079 if ((link->ap->flags & ATA_FLAG_PMP) && ata_is_host_link(link))
2087 return 1; 2080 return 1;
2088 if (classify && !(link->flags & ATA_LFLAG_ASSUME_CLASS) &&
2089 classes[0] == ATA_DEV_UNKNOWN)
2090 return 1;
2091 return 0; 2081 return 0;
2092} 2082}
2093 2083
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index f464ca1fa261..5be8a6058dac 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1929,7 +1929,6 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1929 1929
1930 rc = sata_link_hardreset(link, timing, deadline, &online, 1930 rc = sata_link_hardreset(link, timing, deadline, &online,
1931 ata_sff_check_ready); 1931 ata_sff_check_ready);
1932 *class = ATA_DEV_NONE;
1933 if (online) 1932 if (online)
1934 *class = ata_sff_dev_classify(link->device, 1, NULL); 1933 *class = ata_sff_dev_classify(link->device, 1, NULL);
1935 1934