linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>,
	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 12:40:37 +0300	[thread overview]
Message-ID: <CAHp75Vdcg2GQ4G-YF054iCob+f4=ZmfT_XLknMZm72nOB7D_mw@mail.gmail.com> (raw)
In-Reply-To: <20180604054452.GD17993@dell>

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(...));

?

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-06-04  9:40 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 [this message]
2018-06-04 10:27     ` Charles Keepax
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='CAHp75Vdcg2GQ4G-YF054iCob+f4=ZmfT_XLknMZm72nOB7D_mw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=ckeepax@opensource.cirrus.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).