* [PATCH linux-next] w1: omap-hdq:using the pm_runtime_resume_and_get to simplify the code
@ 2022-08-03 6:11 cgel.zte
2022-08-03 6:19 ` Christophe JAILLET
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-08-03 6:11 UTC (permalink / raw)
To: linux-kernel; +Cc: zbr, ye xingchen, Zeal Robot
From: ye xingchen <ye.xingchen@zte.com.cn>
Using pm_runtime_resume_and_get() to instade of
pm_runtime_get_sync and pm_runtime_put_noidle.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
drivers/w1/masters/omap_hdq.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index bf2ec59c1f9d..ec4292bc0458 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -372,9 +372,8 @@ static u8 omap_w1_triplet(void *_hdq, u8 bdir)
OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK;
u8 mask = ctrl | OMAP_HDQ_CTRL_STATUS_DIR;
- err = pm_runtime_get_sync(hdq_data->dev);
+ err = pm_runtime_resume_and_get(hdq_data->dev);
if (err < 0) {
- pm_runtime_put_noidle(hdq_data->dev);
return err;
}
@@ -463,9 +462,8 @@ static u8 omap_w1_reset_bus(void *_hdq)
struct hdq_data *hdq_data = _hdq;
int err;
- err = pm_runtime_get_sync(hdq_data->dev);
+ err = pm_runtime_resume_and_get(hdq_data->dev);
if (err < 0) {
- pm_runtime_put_noidle(hdq_data->dev);
return err;
}
@@ -485,9 +483,8 @@ static u8 omap_w1_read_byte(void *_hdq)
u8 val = 0;
int ret;
- ret = pm_runtime_get_sync(hdq_data->dev);
+ ret = pm_runtime_resume_and_get(hdq_data->dev);
if (ret < 0) {
- pm_runtime_put_noidle(hdq_data->dev);
return -1;
}
@@ -509,9 +506,8 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)
int ret;
u8 status;
- ret = pm_runtime_get_sync(hdq_data->dev);
+ ret = pm_runtime_resume_and_get(hdq_data->dev);
if (ret < 0) {
- pm_runtime_put_noidle(hdq_data->dev);
return;
}
@@ -605,9 +601,8 @@ static int omap_hdq_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 300);
- ret = pm_runtime_get_sync(&pdev->dev);
+ ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) {
- pm_runtime_put_noidle(&pdev->dev);
dev_dbg(&pdev->dev, "pm_runtime_get_sync failed\n");
goto err_w1;
}
@@ -659,9 +654,8 @@ static int omap_hdq_remove(struct platform_device *pdev)
{
int active;
- active = pm_runtime_get_sync(&pdev->dev);
+ active = pm_runtime_resume_and_get(&pdev->dev);
if (active < 0)
- pm_runtime_put_noidle(&pdev->dev);
w1_remove_master_device(&omap_w1_master);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next] w1: omap-hdq:using the pm_runtime_resume_and_get to simplify the code
2022-08-03 6:11 [PATCH linux-next] w1: omap-hdq:using the pm_runtime_resume_and_get to simplify the code cgel.zte
@ 2022-08-03 6:19 ` Christophe JAILLET
0 siblings, 0 replies; 2+ messages in thread
From: Christophe JAILLET @ 2022-08-03 6:19 UTC (permalink / raw)
To: cgel.zte, linux-kernel; +Cc: zbr, ye xingchen, Zeal Robot
Le 03/08/2022 à 08:11, cgel.zte@gmail.com a écrit :
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Using pm_runtime_resume_and_get() to instade of
> pm_runtime_get_sync and pm_runtime_put_noidle.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
> drivers/w1/masters/omap_hdq.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
> index bf2ec59c1f9d..ec4292bc0458 100644
> --- a/drivers/w1/masters/omap_hdq.c
> +++ b/drivers/w1/masters/omap_hdq.c
> @@ -372,9 +372,8 @@ static u8 omap_w1_triplet(void *_hdq, u8 bdir)
> OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK;
> u8 mask = ctrl | OMAP_HDQ_CTRL_STATUS_DIR;
>
> - err = pm_runtime_get_sync(hdq_data->dev);
> + err = pm_runtime_resume_and_get(hdq_data->dev);
> if (err < 0) {
> - pm_runtime_put_noidle(hdq_data->dev);
>
> return err;
> }
I don't have a strong opinion on the patch itself, but the resulting
would look like:
err = pm_runtime_resume_and_get(hdq_data->dev);
if (err < 0) {
return err;
}
which is odd. { } and extra blank line should be removed, IMHO.
CJ
[...]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-03 6:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 6:11 [PATCH linux-next] w1: omap-hdq:using the pm_runtime_resume_and_get to simplify the code cgel.zte
2022-08-03 6:19 ` Christophe JAILLET
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.