[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aVe4-rUD9aM58xhT@smile.fi.intel.com>
Date: Fri, 2 Jan 2026 14:24:26 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: raskar.shree97@...il.com
Cc: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.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 v4 3/4] iio: proximity: rfd77402: Use kernel helper for
result polling
On Thu, Jan 01, 2026 at 09:47:40PM +0530, Shrikant Raskar via B4 Relay wrote:
> Replace the manually written polling loop with read_poll_timeout(),
> the kernel's standard helper for waiting on hardware status.
> This makes the code easier to read and avoids repeating the same
> polling code in the driver.
...
> index 3262af6f6882..496c1412ebf8 100644
> --- a/drivers/iio/proximity/rfd77402.c
> +++ b/drivers/iio/proximity/rfd77402.c
> @@ -13,6 +13,7 @@
> #include <linux/module.h>
> #include <linux/i2c.h>
> #include <linux/delay.h>
> +#include <linux/iopoll.h>
Even if the original is unsorted, try to place the new inclusion into the
longest sorted (but maybe be sparse) chain. From the given context it might
be somewhere before module.h or less likely after i2c.h.
> #include <linux/iio/iio.h>
...
> + /* Poll ICSR until RESULT bit is set */
> + ret = read_poll_timeout(i2c_smbus_read_byte_data, ret,
> + ret & RFD77402_ICSR_RESULT,
> + 10000, /* sleep: 10ms */
> + 100000, /* timeout: 100ms */
Instead of the noisy comments use proper multipliers
10 * USEC_PER_MSEC
10 * 10 * USEC_PER_MSEC
(yes, 10 * 10 is to distinguish between one iteration delay and the whole op
timeout.)
> + false,
> + client, RFD77402_ICSR);
> + if (ret < 0)
> goto err;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists