Skip to content

Commit 8210887

Browse files
cjd8jic23
authored andcommitted
iio: light: si1133: add local variable for timeout
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> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent fb94aeb commit 8210887

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/iio/light/si1133.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ static int si1133_cmd_reset_counter(struct si1133_data *data)
390390

391391
static int si1133_command(struct si1133_data *data, u8 cmd)
392392
{
393+
unsigned long timeout;
393394
struct device *dev = &data->client->dev;
394395
u32 resp;
395396
int err;
@@ -417,8 +418,8 @@ static int si1133_command(struct si1133_data *data, u8 cmd)
417418

418419
if (cmd == SI1133_CMD_FORCE) {
419420
/* wait for irq */
420-
if (!wait_for_completion_timeout(&data->completion,
421-
msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS))) {
421+
timeout = msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS);
422+
if (!wait_for_completion_timeout(&data->completion, timeout)) {
422423
regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, 0);
423424
err = -ETIMEDOUT;
424425
goto out;

0 commit comments

Comments
 (0)