On Mon, Jun 4, 2018 at 8:44 AM, Lee Jones <[email protected]> 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 via email to