From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Alain Volmat <avolmat@me.com>, Philipp Zabel <p.zabel@pengutronix.de>
Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] reset: sti: rely on regmap_field_read_poll_timeout for ack wait
Date: Wed, 8 Mar 2023 09:49:20 +0100 [thread overview]
Message-ID: <2ef16f3f-4293-b804-e31d-352a2c394df8@foss.st.com> (raw)
In-Reply-To: <20230210224332.98482-1-avolmat@me.com>
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
prev parent reply other threads:[~2023-03-08 8:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 22:43 Alain Volmat
2023-03-08 8:49 ` Patrice CHOTARD [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ef16f3f-4293-b804-e31d-352a2c394df8@foss.st.com \
--to=patrice.chotard@foss.st.com \
--cc=avolmat@me.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®