diff options
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 58bdc538d229..c1db2f234d2e 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2040,7 +2040,7 @@ static void ata_eh_link_report(struct ata_link *link) | |||
2040 | } | 2040 | } |
2041 | 2041 | ||
2042 | if (ehc->i.serror) | 2042 | if (ehc->i.serror) |
2043 | ata_port_printk(ap, KERN_ERR, | 2043 | ata_link_printk(link, KERN_ERR, |
2044 | "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", | 2044 | "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", |
2045 | ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", | 2045 | ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", |
2046 | ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", | 2046 | ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", |
@@ -2171,18 +2171,12 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2171 | } | 2171 | } |
2172 | 2172 | ||
2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, | 2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, |
2174 | int rc, int classify, | 2174 | int rc, const unsigned int *classes) |
2175 | const unsigned int *classes) | ||
2176 | { | 2175 | { |
2177 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) | 2176 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) |
2178 | return 0; | 2177 | return 0; |
2179 | if (rc == -EAGAIN) { | 2178 | if (rc == -EAGAIN) |
2180 | if (classify) | 2179 | return 1; |
2181 | return 1; | ||
2182 | rc = 0; | ||
2183 | } | ||
2184 | if (rc != 0) | ||
2185 | return 0; | ||
2186 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) | 2180 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) |
2187 | return 1; | 2181 | return 1; |
2188 | return 0; | 2182 | return 0; |
@@ -2210,6 +2204,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2210 | */ | 2204 | */ |
2211 | while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) | 2205 | while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) |
2212 | max_tries++; | 2206 | max_tries++; |
2207 | if (link->flags & ATA_LFLAG_NO_HRST) | ||
2208 | hardreset = NULL; | ||
2209 | if (link->flags & ATA_LFLAG_NO_SRST) | ||
2210 | softreset = NULL; | ||
2213 | 2211 | ||
2214 | now = jiffies; | 2212 | now = jiffies; |
2215 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); | 2213 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); |
@@ -2247,10 +2245,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2247 | ehc->i.action &= ~ATA_EH_RESET; | 2245 | ehc->i.action &= ~ATA_EH_RESET; |
2248 | if (hardreset) { | 2246 | if (hardreset) { |
2249 | reset = hardreset; | 2247 | reset = hardreset; |
2250 | ehc->i.action = ATA_EH_HARDRESET; | 2248 | ehc->i.action |= ATA_EH_HARDRESET; |
2251 | } else if (softreset) { | 2249 | } else if (softreset) { |
2252 | reset = softreset; | 2250 | reset = softreset; |
2253 | ehc->i.action = ATA_EH_SOFTRESET; | 2251 | ehc->i.action |= ATA_EH_SOFTRESET; |
2254 | } | 2252 | } |
2255 | 2253 | ||
2256 | if (prereset) { | 2254 | if (prereset) { |
@@ -2305,9 +2303,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2305 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2303 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
2306 | 2304 | ||
2307 | rc = ata_do_reset(link, reset, classes, deadline); | 2305 | rc = ata_do_reset(link, reset, classes, deadline); |
2306 | if (rc && rc != -EAGAIN) | ||
2307 | goto fail; | ||
2308 | 2308 | ||
2309 | if (reset == hardreset && | 2309 | if (reset == hardreset && |
2310 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { | 2310 | ata_eh_followup_srst_needed(link, rc, classes)) { |
2311 | /* okay, let's do follow-up softreset */ | 2311 | /* okay, let's do follow-up softreset */ |
2312 | reset = softreset; | 2312 | reset = softreset; |
2313 | 2313 | ||
@@ -2322,10 +2322,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2323 | rc = ata_do_reset(link, reset, classes, deadline); | 2323 | rc = ata_do_reset(link, reset, classes, deadline); |
2324 | } | 2324 | } |
2325 | |||
2326 | /* -EAGAIN can happen if we skipped followup SRST */ | ||
2327 | if (rc && rc != -EAGAIN) | ||
2328 | goto fail; | ||
2329 | } else { | 2325 | } else { |
2330 | if (verbose) | 2326 | if (verbose) |
2331 | ata_link_printk(link, KERN_INFO, "no reset method " | 2327 | ata_link_printk(link, KERN_INFO, "no reset method " |