Skip to content

Commit 109552b

Browse files
eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
JIRA: https://issues.redhat.com/browse/RHEL-47160 Conflicts: * Avoiding commit <f050bb8f56c64> ("misc: Switch i2c drivers back to use .probe()") to avoid drop the .probe_new() call-back type commit e68f487 Author: Heiner Kallweit <hkallweit1@gmail.com> Date: Wed Dec 20 16:11:14 2023 +0100 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 <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/c3045427-da42-4f7c-8a96-3c4756646cd0@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
1 parent b58d264 commit 109552b

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)