* [PATCH] reset: sti: rely on regmap_field_read_poll_timeout for ack wait
@ 2023-02-10 22:43 Alain Volmat
2023-03-08 8:49 ` Patrice CHOTARD
0 siblings, 1 reply; 2+ messages in thread
From: Alain Volmat @ 2023-02-10 22:43 UTC (permalink / raw)
To: Patrice Chotard, Philipp Zabel
Cc: Alain Volmat, linux-arm-kernel, linux-kernel
Use regmap_field_read_poll_timeout function when waiting for the
ack bit upon performing the reset control.
Signed-off-by: Alain Volmat <avolmat@me.com>
---
drivers/reset/sti/reset-syscfg.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c
index b4b46e0f207e..c1ba04f6f155 100644
--- a/drivers/reset/sti/reset-syscfg.c
+++ b/drivers/reset/sti/reset-syscfg.c
@@ -64,22 +64,12 @@ static int syscfg_reset_program_hw(struct reset_controller_dev *rcdev,
return err;
if (ch->ack) {
- unsigned long timeout = jiffies + msecs_to_jiffies(1000);
u32 ack_val;
- while (true) {
- err = regmap_field_read(ch->ack, &ack_val);
- if (err)
- return err;
-
- if (ack_val == ctrl_val)
- break;
-
- if (time_after(jiffies, timeout))
- return -ETIME;
-
- cpu_relax();
- }
+ err = regmap_field_read_poll_timeout(ch->ack, ack_val, (ack_val == ctrl_val),
+ 100, USEC_PER_SEC);
+ if (err)
+ return err;
}
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] reset: sti: rely on regmap_field_read_poll_timeout for ack wait
2023-02-10 22:43 [PATCH] reset: sti: rely on regmap_field_read_poll_timeout for ack wait Alain Volmat
@ 2023-03-08 8:49 ` Patrice CHOTARD
0 siblings, 0 replies; 2+ messages in thread
From: Patrice CHOTARD @ 2023-03-08 8:49 UTC (permalink / raw)
To: Alain Volmat, Philipp Zabel; +Cc: linux-arm-kernel, linux-kernel
Hi Alain
On 2/10/23 23:43, Alain Volmat wrote:
> Use regmap_field_read_poll_timeout function when waiting for the
> ack bit upon performing the reset control.
>
> Signed-off-by: Alain Volmat <avolmat@me.com>
> ---
> drivers/reset/sti/reset-syscfg.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c
> index b4b46e0f207e..c1ba04f6f155 100644
> --- a/drivers/reset/sti/reset-syscfg.c
> +++ b/drivers/reset/sti/reset-syscfg.c
> @@ -64,22 +64,12 @@ static int syscfg_reset_program_hw(struct reset_controller_dev *rcdev,
> return err;
>
> if (ch->ack) {
> - unsigned long timeout = jiffies + msecs_to_jiffies(1000);
> u32 ack_val;
>
> - while (true) {
> - err = regmap_field_read(ch->ack, &ack_val);
> - if (err)
> - return err;
> -
> - if (ack_val == ctrl_val)
> - break;
> -
> - if (time_after(jiffies, timeout))
> - return -ETIME;
> -
> - cpu_relax();
> - }
> + err = regmap_field_read_poll_timeout(ch->ack, ack_val, (ack_val == ctrl_val),
> + 100, USEC_PER_SEC);
> + if (err)
> + return err;
> }
>
> return 0;
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-08 8:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 22:43 [PATCH] reset: sti: rely on regmap_field_read_poll_timeout for ack wait Alain Volmat
2023-03-08 8:49 ` Patrice CHOTARD
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®