[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfPjQB3UqMEb===5j0YYoWn6mMuaaAdTjUcFMuChBq6_w@mail.gmail.com>
Date: Sun, 30 Nov 2025 18:52:02 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Shrikant Raskar <raskar.shree97@...il.com>
Cc: jic23@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org, heiko@...ech.de,
neil.armstrong@...aro.org, skhan@...uxfoundation.org,
david.hunter.linux@...il.com, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] iio: proximity: rfd77402: Move polling logic into helper
On Sun, Nov 30, 2025 at 5:37 PM Shrikant Raskar
<raskar.shree97@...il.com> wrote:
>
> This change extracts the polling logic into a dedicated helper,
Imperative voice.
> rfd77402_result_polling(), which improves readability and keeps
> rfd77402_measure() focused on the high-level measurement flow.
>
> This refactoring is also a necessary preparation step for adding
> interrupt-based result handling in a follow-up patch.
...
> + while (tries-- > 0) {
> + ret = i2c_smbus_read_byte_data(client, RFD77402_ICSR);
> + if (ret < 0)
> + return ret;
> +
> + if (ret & RFD77402_ICSR_RESULT)
> + return 0;
> +
> + msleep(20);
> + }
> +
> + return -ETIMEDOUT;
Reimplementation of one macro from iopoll.h. Include that and use a
single call, will be something like
return read_poll_timeout(...);
...
> + ret = rfd77402_result_polling(client);
Ah, even better, you don't need a function for that at all. Just use
that macro here inline.
> + if (ret < 0)
> goto err;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists