aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-eh.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5b5ae631ed03..83d1451fa714 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -90,7 +90,7 @@ static const unsigned long ata_eh_reset_timeouts[] = {
90 10000, /* > 99% working drives spin up before 20sec */ 90 10000, /* > 99% working drives spin up before 20sec */
91 35000, /* give > 30 secs of idleness for retarded devices */ 91 35000, /* give > 30 secs of idleness for retarded devices */
92 5000, /* and sweet one last chance */ 92 5000, /* and sweet one last chance */
93 /* > 1 min has elapsed, give up */ 93 ULONG_MAX, /* > 1 min has elapsed, give up */
94}; 94};
95 95
96static void __ata_port_freeze(struct ata_port *ap); 96static void __ata_port_freeze(struct ata_port *ap);
@@ -2077,13 +2077,12 @@ int ata_eh_reset(struct ata_link *link, int classify,
2077 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 2077 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
2078 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 2078 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
2079{ 2079{
2080 const int max_tries = ARRAY_SIZE(ata_eh_reset_timeouts);
2081 struct ata_port *ap = link->ap; 2080 struct ata_port *ap = link->ap;
2082 struct ata_eh_context *ehc = &link->eh_context; 2081 struct ata_eh_context *ehc = &link->eh_context;
2083 unsigned int *classes = ehc->classes; 2082 unsigned int *classes = ehc->classes;
2084 unsigned int lflags = link->flags; 2083 unsigned int lflags = link->flags;
2085 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 2084 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
2086 int try = 0; 2085 int max_tries = 0, try = 0;
2087 struct ata_device *dev; 2086 struct ata_device *dev;
2088 unsigned long deadline, now; 2087 unsigned long deadline, now;
2089 ata_reset_fn_t reset; 2088 ata_reset_fn_t reset;
@@ -2094,6 +2093,9 @@ int ata_eh_reset(struct ata_link *link, int classify,
2094 /* 2093 /*
2095 * Prepare to reset 2094 * Prepare to reset
2096 */ 2095 */
2096 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX)
2097 max_tries++;
2098
2097 now = jiffies; 2099 now = jiffies;
2098 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); 2100 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN);
2099 if (time_before(now, deadline)) 2101 if (time_before(now, deadline))