* [PATCH] regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone
@ 2019-09-29 9:58 Axel Lin
2019-09-30 11:36 ` Nishanth Menon
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2019-09-29 9:58 UTC (permalink / raw)
To: Mark Brown
Cc: Nishanth Menon, Andrii . Tseglytskyi, Liam Girdwood,
linux-kernel, Axel Lin
ti_abb_wait_txdone() may return -ETIMEDOUT when ti_abb_check_txdone()
returns true in the latest iteration of the while loop because the timeout
value is abb->settling_time + 1. Similarly, ti_abb_clear_all_txdone() may
return -ETIMEDOUT when ti_abb_check_txdone() returns false in the latest
iteration of the while loop. Fix it.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/ti-abb-regulator.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
index cced1ffb896c..89b9314d64c9 100644
--- a/drivers/regulator/ti-abb-regulator.c
+++ b/drivers/regulator/ti-abb-regulator.c
@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb)
while (timeout++ <= abb->settling_time) {
status = ti_abb_check_txdone(abb);
if (status)
- break;
+ return 0;
udelay(1);
}
- if (timeout > abb->settling_time) {
- dev_warn_ratelimited(dev,
- "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
- __func__, timeout, readl(abb->int_base));
- return -ETIMEDOUT;
- }
-
- return 0;
+ dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
+ __func__, timeout, readl(abb->int_base));
+ return -ETIMEDOUT;
}
/**
@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb)
status = ti_abb_check_txdone(abb);
if (!status)
- break;
+ return 0;
udelay(1);
}
- if (timeout > abb->settling_time) {
- dev_warn_ratelimited(dev,
- "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
- __func__, timeout, readl(abb->int_base));
- return -ETIMEDOUT;
- }
-
- return 0;
+ dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
+ __func__, timeout, readl(abb->int_base));
+ return -ETIMEDOUT;
}
/**
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone
2019-09-29 9:58 [PATCH] regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone Axel Lin
@ 2019-09-30 11:36 ` Nishanth Menon
0 siblings, 0 replies; 2+ messages in thread
From: Nishanth Menon @ 2019-09-30 11:36 UTC (permalink / raw)
To: Axel Lin; +Cc: Mark Brown, Liam Girdwood, linux-kernel
On 17:58-20190929, Axel Lin wrote:
> ti_abb_wait_txdone() may return -ETIMEDOUT when ti_abb_check_txdone()
> returns true in the latest iteration of the while loop because the timeout
> value is abb->settling_time + 1. Similarly, ti_abb_clear_all_txdone() may
> return -ETIMEDOUT when ti_abb_check_txdone() returns false in the latest
> iteration of the while loop. Fix it.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Nishanth Menon <nm@ti.com>
Mark, if you could pick it up, will be great.
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-30 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29 9:58 [PATCH] regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone Axel Lin
2019-09-30 11:36 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®