[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220418110811.2559529-1-chi.minghao@zte.com.cn>
Date: Mon, 18 Apr 2022 11:08:11 +0000
From: cgel.zte@...il.com
To: brgl@...ev.pl
Cc: arnd@...db.de, gregkh@...uxfoundation.org,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
Minghao Chi <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH] misc/eeprom: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
From: Minghao Chi <chi.minghao@....com.cn>
Using pm_runtime_resume_and_get is more appropriate
for simplifing code
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
---
drivers/misc/eeprom/at24.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 633e1cf08d6e..0a5bdd629427 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -431,11 +431,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
if (off + count > at24->byte_len)
return -EINVAL;
- ret = pm_runtime_get_sync(dev);
- if (ret < 0) {
- pm_runtime_put_noidle(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
return ret;
- }
/*
* Read data from chip, protecting against concurrent updates
@@ -478,11 +476,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
if (off + count > at24->byte_len)
return -EINVAL;
- ret = pm_runtime_get_sync(dev);
- if (ret < 0) {
- pm_runtime_put_noidle(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
return ret;
- }
/*
* Write data to chip, protecting against concurrent updates
--
2.25.1
Powered by blists - more mailing lists