diff mbox series

[04/11] irqchip/renesas-rzv2h: Simplify rzv2h_icu_init()

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

Commit Message

Biju Das Jan. 20, 2025, 9:47 a.m. UTC
Simplify rzv2h_icu_init() by using newly added devm_* helpers.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzv2h.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Philipp Zabel Jan. 20, 2025, 10:04 a.m. UTC | #1
On Mo, 2025-01-20 at 09:47 +0000, Biju Das wrote:
> Simplify rzv2h_icu_init() by using newly added devm_* helpers.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/irqchip/irq-renesas-rzv2h.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
> index fd432b43506b..a02d47529564 100644
> --- a/drivers/irqchip/irq-renesas-rzv2h.c
> +++ b/drivers/irqchip/irq-renesas-rzv2h.c
> @@ -456,23 +456,23 @@ static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
>  		goto put_dev;
>  	}
>  
> -	resetn = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> +	resetn = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);

This changes the reset control to be optional without mentioning it in
the commit description. Should this change be part of another patch?

regards
Philipp
Biju Das Jan. 20, 2025, 10:18 a.m. UTC | #2
Hi Philipp,

Thanks for the review.

> -----Original Message-----
> From: Philipp Zabel <p.zabel@pengutronix.de>
> Sent: 20 January 2025 10:05
> Subject: Re: [PATCH 04/11] irqchip/renesas-rzv2h: Simplify rzv2h_icu_init()
> 
> On Mo, 2025-01-20 at 09:47 +0000, Biju Das wrote:
> > Simplify rzv2h_icu_init() by using newly added devm_* helpers.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/irqchip/irq-renesas-rzv2h.c | 15 ++++++---------
> >  1 file changed, 6 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-renesas-rzv2h.c
> > b/drivers/irqchip/irq-renesas-rzv2h.c
> > index fd432b43506b..a02d47529564 100644
> > --- a/drivers/irqchip/irq-renesas-rzv2h.c
> > +++ b/drivers/irqchip/irq-renesas-rzv2h.c
> > @@ -456,23 +456,23 @@ static int rzv2h_icu_init(struct device_node *node, struct device_node
> *parent)
> >  		goto put_dev;
> >  	}
> >
> > -	resetn = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> > +	resetn =
> > +devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev,
> > +NULL);
> 
> This changes the reset control to be optional without mentioning it in the commit description. Should
> this change be part of another patch?

Thanks, It is a typo. It should be devm_reset_control_get_exclusive_deasserted.

I will split simplification patches into two in the next version.

1) Adding devm_reset_control_get_exclusive_deasserted()
2) Adding devm_pm_runtime_enable()

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
index fd432b43506b..a02d47529564 100644
--- a/drivers/irqchip/irq-renesas-rzv2h.c
+++ b/drivers/irqchip/irq-renesas-rzv2h.c
@@ -456,23 +456,23 @@  static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
 		goto put_dev;
 	}
 
-	resetn = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+	resetn = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
 	if (IS_ERR(resetn)) {
 		ret = PTR_ERR(resetn);
+		dev_err(&pdev->dev, "failed to acquire deasserted reset: %d\n", ret);
 		goto put_dev;
 	}
 
-	ret = reset_control_deassert(resetn);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to deassert resetn pin, %d\n", ret);
+	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;
 	}
 
-	pm_runtime_enable(&pdev->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);
@@ -493,9 +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);
-	reset_control_assert(resetn);
 put_dev:
 	put_device(&pdev->dev);