Skip to content

Commit e68f487

Browse files
hkallweitgregkh
authored andcommitted
eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
Use helper pm_runtime_resume_and_get() to simplify the code. Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent caba40e commit e68f487

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/misc/eeprom/at24.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
439439
if (off + count > at24->byte_len)
440440
return -EINVAL;
441441

442-
ret = pm_runtime_get_sync(dev);
443-
if (ret < 0) {
444-
pm_runtime_put_noidle(dev);
442+
ret = pm_runtime_resume_and_get(dev);
443+
if (ret)
445444
return ret;
446-
}
447-
448445
/*
449446
* Read data from chip, protecting against concurrent updates
450447
* from this host, but not from other I2C masters.
@@ -486,12 +483,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
486483
if (off + count > at24->byte_len)
487484
return -EINVAL;
488485

489-
ret = pm_runtime_get_sync(dev);
490-
if (ret < 0) {
491-
pm_runtime_put_noidle(dev);
486+
ret = pm_runtime_resume_and_get(dev);
487+
if (ret)
492488
return ret;
493-
}
494-
495489
/*
496490
* Write data to chip, protecting against concurrent updates
497491
* from this host, but not from other I2C masters.

0 commit comments

Comments
 (0)