* [PATCH] i2c: i2c-davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
@ 2022-04-14 9:07 cgel.zte
2022-04-18 19:14 ` Bartosz Golaszewski
2022-05-04 20:41 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-14 9:07 UTC (permalink / raw)
To: nsekhar
Cc: brgl, linux-arm-kernel, linux-i2c, linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi <chi.minghao@zte.com.cn>
Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. This change is just to simplify the code, no
actual functional changes.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
drivers/i2c/busses/i2c-davinci.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index e9d07323c604..9e09db31a937 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -539,10 +539,9 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
- ret = pm_runtime_get_sync(dev->dev);
+ ret = pm_runtime_resume_and_get(dev->dev);
if (ret < 0) {
dev_err(dev->dev, "Failed to runtime_get device: %d\n", ret);
- pm_runtime_put_noidle(dev->dev);
return ret;
}
@@ -821,10 +820,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
pm_runtime_enable(dev->dev);
- r = pm_runtime_get_sync(dev->dev);
+ r = pm_runtime_resume_and_get(dev->dev);
if (r < 0) {
dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
- pm_runtime_put_noidle(dev->dev);
return r;
}
@@ -898,11 +896,9 @@ static int davinci_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(&dev->adapter);
- ret = pm_runtime_get_sync(&pdev->dev);
- if (ret < 0) {
- pm_runtime_put_noidle(&pdev->dev);
+ ret = pm_runtime_resume_and_get(&pdev->dev);
+ if (ret < 0)
return ret;
- }
davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: i2c-davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
2022-04-14 9:07 [PATCH] i2c: i2c-davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
@ 2022-04-18 19:14 ` Bartosz Golaszewski
2022-05-04 20:41 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2022-04-18 19:14 UTC (permalink / raw)
To: cgel.zte
Cc: Sekhar Nori, Linux ARM, linux-i2c, Linux Kernel Mailing List,
Minghao Chi, Zeal Robot
On Thu, Apr 14, 2022 at 11:07 AM <cgel.zte@gmail.com> wrote:
>
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. This change is just to simplify the code, no
> actual functional changes.
I would love it if people started adding some notes on how
pm_runtime_and_get() can replace the other two in the commit messages
for these patches. Anyway FWIW:
Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/i2c/busses/i2c-davinci.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index e9d07323c604..9e09db31a937 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -539,10 +539,9 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>
> dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
>
> - ret = pm_runtime_get_sync(dev->dev);
> + ret = pm_runtime_resume_and_get(dev->dev);
> if (ret < 0) {
> dev_err(dev->dev, "Failed to runtime_get device: %d\n", ret);
> - pm_runtime_put_noidle(dev->dev);
> return ret;
> }
>
> @@ -821,10 +820,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>
> pm_runtime_enable(dev->dev);
>
> - r = pm_runtime_get_sync(dev->dev);
> + r = pm_runtime_resume_and_get(dev->dev);
> if (r < 0) {
> dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
> - pm_runtime_put_noidle(dev->dev);
> return r;
> }
>
> @@ -898,11 +896,9 @@ static int davinci_i2c_remove(struct platform_device *pdev)
>
> i2c_del_adapter(&dev->adapter);
>
> - ret = pm_runtime_get_sync(&pdev->dev);
> - if (ret < 0) {
> - pm_runtime_put_noidle(&pdev->dev);
> + ret = pm_runtime_resume_and_get(&pdev->dev);
> + if (ret < 0)
> return ret;
> - }
>
> davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
>
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: i2c-davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
2022-04-14 9:07 [PATCH] i2c: i2c-davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
2022-04-18 19:14 ` Bartosz Golaszewski
@ 2022-05-04 20:41 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-05-04 20:41 UTC (permalink / raw)
To: cgel.zte
Cc: nsekhar, brgl, linux-arm-kernel, linux-i2c, linux-kernel,
Minghao Chi, Zeal Robot
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]
On Thu, Apr 14, 2022 at 09:07:27AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. This change is just to simplify the code, no
> actual functional changes.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-04 20:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 9:07 [PATCH] i2c: i2c-davinci: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
2022-04-18 19:14 ` Bartosz Golaszewski
2022-05-04 20:41 ` Wolfram Sang
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).