From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>, <patches@opensource.cirrus.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mfd: arizona: Don't use regmap_read_poll_timeout
Date: Mon, 4 Jun 2018 11:27:19 +0100 [thread overview]
Message-ID: <20180604102719.GA18740@imbe.wolfsonmicro.main> (raw)
In-Reply-To: <CAHp75Vdcg2GQ4G-YF054iCob+f4=ZmfT_XLknMZm72nOB7D_mw@mail.gmail.com>
On Mon, Jun 04, 2018 at 12:40:37PM +0300, Andy Shevchenko wrote:
> On Mon, Jun 4, 2018 at 8:44 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Fri, 11 May 2018, Charles Keepax wrote:
>
> >> + while (true) {
> >> + ret = regmap_read(arizona->regmap, reg, &val);
> >>
> >> + if ((val & mask) == target)
> >> + return 0;
> >> +
> >> + if (ktime_compare(ktime_get(), timeout) > 0)
> >> + break;
> >> +
> >> + usleep_range(ARIZONA_REG_POLL_DELAY_US / 2,
> >> + ARIZONA_REG_POLL_DELAY_US);
> >> + }
>
> >From my point of view infinite loops not good for readability and maintenance.
> Perhaps
>
> do {
> ...
> } while (ktime_compare(...));
>
> ?
I would rather not do it that way since then it becomes
impossible to have a single poll with no delays happening. I can
refactor to remove the while(true) but it will make the code a
bit bigger, as I will probably need to duplicate some code
outside the loop.
Thanks,
Charles
next prev parent reply other threads:[~2018-06-04 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 13:50 [PATCH] mfd: arizona: Don't use regmap_read_poll_timeout Charles Keepax
2018-06-04 5:44 ` Lee Jones
2018-06-04 9:40 ` Andy Shevchenko
2018-06-04 10:27 ` Charles Keepax [this message]
2018-06-04 10:55 ` Charles Keepax
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=20180604102719.GA18740@imbe.wolfsonmicro.main \
--to=ckeepax@opensource.cirrus.com \
--cc=andy.shevchenko@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.