Messages in this thread Patch in this message |  | | Date | Tue, 5 May 2026 13:30:22 +0100 | | From | Jonathan Cameron <> | | Subject | Re: [PATCH v5 7/8] iio: light: si1133: add local variable for timeout |
| |
On Tue, 05 May 2026 09:31:32 +0200 Joshua Crofts via B4 Relay <devnull+joshua.crofts1.gmail.com@kernel.org> wrote:
> From: Joshua Crofts <joshua.crofts1@gmail.com> > > Add local variable for timeout to improve readability. > > No functional change. > > Suggested-by: Jonathan Cameron <jic23@kernel.org> > Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Tweaked as I mentioned in my late reply to v4 thread.
diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index a3e4ab25acdc..ef5c38e303a6 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -390,7 +390,7 @@ static int si1133_cmd_reset_counter(struct si1133_data *data) static int si1133_command(struct si1133_data *data, u8 cmd) { - unsigned long timeout = msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS); + unsigned long timeout; struct device *dev = &data->client->dev; u32 resp; int err; @@ -418,6 +418,7 @@ static int si1133_command(struct si1133_data *data, u8 cmd) if (cmd == SI1133_CMD_FORCE) { /* wait for irq */ + timeout = msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS); if (!wait_for_completion_timeout(&data->completion, timeout)) { regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, 0); err = -ETIMEDOUT;
> --- > drivers/iio/light/si1133.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c > index fdffdee16e493277d95c369ec2f6c0678cf9f61c..a3e4ab25acdc105d3800994f4391a7e4291e1c74 100644 > --- a/drivers/iio/light/si1133.c > +++ b/drivers/iio/light/si1133.c > @@ -390,6 +390,7 @@ static int si1133_cmd_reset_counter(struct si1133_data *data) > > static int si1133_command(struct si1133_data *data, u8 cmd) > { > + unsigned long timeout = msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS); > struct device *dev = &data->client->dev; > u32 resp; > int err; > @@ -417,8 +418,7 @@ static int si1133_command(struct si1133_data *data, u8 cmd) > > if (cmd == SI1133_CMD_FORCE) { > /* wait for irq */ > - if (!wait_for_completion_timeout(&data->completion, > - msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS))) { > + if (!wait_for_completion_timeout(&data->completion, timeout)) { > regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, 0); > err = -ETIMEDOUT; > goto out; >
|  |