* [PATCH] misc/eeprom: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
@ 2022-04-18 11:08 cgel.zte
2022-04-18 18:55 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-04-18 11:08 UTC (permalink / raw)
To: brgl; +Cc: arnd, gregkh, linux-i2c, linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi <chi.minghao@zte.com.cn>
Using pm_runtime_resume_and_get is more appropriate
for simplifing code
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] misc/eeprom: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
2022-04-18 11:08 [PATCH] misc/eeprom: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
@ 2022-04-18 18:55 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2022-04-18 18:55 UTC (permalink / raw)
To: cgel.zte
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-i2c,
Linux Kernel Mailing List, Minghao Chi, Zeal Robot
On Mon, Apr 18, 2022 at 1:08 PM <cgel.zte@gmail.com> wrote:
>
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code
>
The commit subject should be "eeprom: at24: ..." and the commit
message is missing the *why* for this change. Otherwise looks good.
Bart
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-18 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 11:08 [PATCH] misc/eeprom: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
2022-04-18 18:55 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).