diff mbox series

[v2,05/12] irqchip/renesas-rzv2h: Simplify rzv2h_icu_init()

Message ID 20250127113723.24479-6-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Add Support for RZ/G3E ICU | expand

Commit Message

Biju Das Jan. 27, 2025, 11:37 a.m. UTC
Simplify rzv2h_icu_init() by using devm_pm_runtime_enable().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2:
 * New patch.
---
 drivers/irqchip/irq-renesas-rzv2h.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Philipp Zabel Jan. 27, 2025, 2:05 p.m. UTC | #1
On Mo, 2025-01-27 at 11:37 +0000, Biju Das wrote:
> Simplify rzv2h_icu_init() by using devm_pm_runtime_enable().
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v2:
>  * New patch.
> ---
>  drivers/irqchip/irq-renesas-rzv2h.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
> index 5c5d2e015a88..f90652013082 100644
> --- a/drivers/irqchip/irq-renesas-rzv2h.c
> +++ b/drivers/irqchip/irq-renesas-rzv2h.c
> @@ -463,11 +463,16 @@ static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
>  		goto put_dev;
>  	}
>  
> -	pm_runtime_enable(&pdev->dev);
> +	ret = devm_pm_runtime_enable(&pdev->dev);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "devm_pm_runtime_enable failed, %d\n", ret);
> +		goto put_dev;
> +	}
> +
>  	ret = pm_runtime_resume_and_get(&pdev->dev);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "pm_runtime_resume_and_get failed: %d\n", ret);
> -		goto pm_disable;
> +		goto put_dev;
>  	}
>  
>  	raw_spin_lock_init(&rzv2h_icu_data->lock);
> @@ -488,8 +493,6 @@ static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
>  
>  pm_put:
>  	pm_runtime_put(&pdev->dev);
> -pm_disable:
> -	pm_runtime_disable(&pdev->dev);
>  put_dev:
>  	put_device(&pdev->dev);

Same comment as for the previous patch, pm_runtime_disable() is now
called after put_device().

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
index 5c5d2e015a88..f90652013082 100644
--- a/drivers/irqchip/irq-renesas-rzv2h.c
+++ b/drivers/irqchip/irq-renesas-rzv2h.c
@@ -463,11 +463,16 @@  static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
 		goto put_dev;
 	}
 
-	pm_runtime_enable(&pdev->dev);
+	ret = devm_pm_runtime_enable(&pdev->dev);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "devm_pm_runtime_enable failed, %d\n", ret);
+		goto put_dev;
+	}
+
 	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "pm_runtime_resume_and_get failed: %d\n", ret);
-		goto pm_disable;
+		goto put_dev;
 	}
 
 	raw_spin_lock_init(&rzv2h_icu_data->lock);
@@ -488,8 +493,6 @@  static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
 
 pm_put:
 	pm_runtime_put(&pdev->dev);
-pm_disable:
-	pm_runtime_disable(&pdev->dev);
 put_dev:
 	put_device(&pdev->dev);