[PATCH 11/12] pinctrl: starfive: Move PM device over to irq domain

Marc Zyngier posted 12 patches 2 years, 9 months ago
[PATCH 11/12] pinctrl: starfive: Move PM device over to irq domain
Posted by Marc Zyngier 2 years, 9 months ago
Move the reference to the device over to the irq domain.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 drivers/pinctrl/pinctrl-starfive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-starfive.c b/drivers/pinctrl/pinctrl-starfive.c
index 0b912152a405..5be9866c2b3c 100644
--- a/drivers/pinctrl/pinctrl-starfive.c
+++ b/drivers/pinctrl/pinctrl-starfive.c
@@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
 	sfp->gc.base = -1;
 	sfp->gc.ngpio = NR_GPIOS;
 
-	starfive_irq_chip.parent_device = dev;
 	starfive_irq_chip.name = sfp->gc.label;
 
 	sfp->gc.irq.chip = &starfive_irq_chip;
@@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "could not register gpiochip\n");
 
+	irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
+
 out_pinctrl_enable:
 	return pinctrl_enable(sfp->pctl);
 }
-- 
2.30.2

Re: [PATCH 11/12] pinctrl: starfive: Move PM device over to irq domain
Posted by Emil Renner Berthing 2 years, 9 months ago
On Tue, 1 Feb 2022 at 13:19, Marc Zyngier <maz@kernel.org> wrote:
>
> Move the reference to the device over to the irq domain.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  drivers/pinctrl/pinctrl-starfive.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-starfive.c b/drivers/pinctrl/pinctrl-starfive.c
> index 0b912152a405..5be9866c2b3c 100644
> --- a/drivers/pinctrl/pinctrl-starfive.c
> +++ b/drivers/pinctrl/pinctrl-starfive.c
> @@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
>         sfp->gc.base = -1;
>         sfp->gc.ngpio = NR_GPIOS;
>
> -       starfive_irq_chip.parent_device = dev;
>         starfive_irq_chip.name = sfp->gc.label;
>
>         sfp->gc.irq.chip = &starfive_irq_chip;
> @@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
>         if (ret)
>                 return dev_err_probe(dev, ret, "could not register gpiochip\n");
>
> +       irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
> +

The gpio framework uses the irq_domain at sfp->gc.irq.domain, so
shouldn't this be set before registering the gpio_chip with
devm_gpiochip_add_data above?

>  out_pinctrl_enable:
>         return pinctrl_enable(sfp->pctl);
>  }
> --
> 2.30.2
>
Re: [PATCH 11/12] pinctrl: starfive: Move PM device over to irq domain
Posted by Emil Renner Berthing 2 years, 9 months ago
On Tue, 1 Feb 2022 at 16:16, Emil Renner Berthing <kernel@esmil.dk> wrote:
> On Tue, 1 Feb 2022 at 13:19, Marc Zyngier <maz@kernel.org> wrote:
> >
> > Move the reference to the device over to the irq domain.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  drivers/pinctrl/pinctrl-starfive.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-starfive.c b/drivers/pinctrl/pinctrl-starfive.c
> > index 0b912152a405..5be9866c2b3c 100644
> > --- a/drivers/pinctrl/pinctrl-starfive.c
> > +++ b/drivers/pinctrl/pinctrl-starfive.c
> > @@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
> >         sfp->gc.base = -1;
> >         sfp->gc.ngpio = NR_GPIOS;
> >
> > -       starfive_irq_chip.parent_device = dev;
> >         starfive_irq_chip.name = sfp->gc.label;
> >
> >         sfp->gc.irq.chip = &starfive_irq_chip;
> > @@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
> >         if (ret)
> >                 return dev_err_probe(dev, ret, "could not register gpiochip\n");
> >
> > +       irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
> > +
>
> The gpio framework uses the irq_domain at sfp->gc.irq.domain, so
> shouldn't this be set before registering the gpio_chip with
> devm_gpiochip_add_data above?

Ah, no. sfp->gc.irq.domain is a pointer to an irq_domain that is
initialised when adding the gpio_chip.

Reviewed-by: Emil Renner Berthing <kernel@esmil.dk>
Re: [PATCH 11/12] pinctrl: starfive: Move PM device over to irq domain
Posted by Marc Zyngier 2 years, 9 months ago
On Tue, 01 Feb 2022 15:16:39 +0000,
Emil Renner Berthing <kernel@esmil.dk> wrote:
> 
> On Tue, 1 Feb 2022 at 13:19, Marc Zyngier <maz@kernel.org> wrote:
> >
> > Move the reference to the device over to the irq domain.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  drivers/pinctrl/pinctrl-starfive.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-starfive.c b/drivers/pinctrl/pinctrl-starfive.c
> > index 0b912152a405..5be9866c2b3c 100644
> > --- a/drivers/pinctrl/pinctrl-starfive.c
> > +++ b/drivers/pinctrl/pinctrl-starfive.c
> > @@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
> >         sfp->gc.base = -1;
> >         sfp->gc.ngpio = NR_GPIOS;
> >
> > -       starfive_irq_chip.parent_device = dev;
> >         starfive_irq_chip.name = sfp->gc.label;
> >
> >         sfp->gc.irq.chip = &starfive_irq_chip;
> > @@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
> >         if (ret)
> >                 return dev_err_probe(dev, ret, "could not register gpiochip\n");
> >
> > +       irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
> > +
> 
> The gpio framework uses the irq_domain at sfp->gc.irq.domain, so
> shouldn't this be set before registering the gpio_chip with
> devm_gpiochip_add_data above?

It is devm_gpiochip_add_data() that create the domain, so there is
nothing to set before.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
[irqchip: irq/irqchip-next] pinctrl: starfive: Move PM device over to irq domain
Posted by irqchip-bot for Marc Zyngier 2 years, 9 months ago
The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     de72f9429628e9c5b1124087c36bd7457b2ab241
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/de72f9429628e9c5b1124087c36bd7457b2ab241
Author:        Marc Zyngier <maz@kernel.org>
AuthorDate:    Tue, 01 Feb 2022 12:03:09 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Wed, 09 Feb 2022 13:36:54 

pinctrl: starfive: Move PM device over to irq domain

Move the reference to the device over to the irq domain.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Emil Renner Berthing <kernel@esmil.dk>
Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
Link: https://lore.kernel.org/r/20220201120310.878267-12-maz@kernel.org
---
 drivers/pinctrl/pinctrl-starfive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-starfive.c b/drivers/pinctrl/pinctrl-starfive.c
index 0b91215..5be9866 100644
--- a/drivers/pinctrl/pinctrl-starfive.c
+++ b/drivers/pinctrl/pinctrl-starfive.c
@@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
 	sfp->gc.base = -1;
 	sfp->gc.ngpio = NR_GPIOS;
 
-	starfive_irq_chip.parent_device = dev;
 	starfive_irq_chip.name = sfp->gc.label;
 
 	sfp->gc.irq.chip = &starfive_irq_chip;
@@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "could not register gpiochip\n");
 
+	irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
+
 out_pinctrl_enable:
 	return pinctrl_enable(sfp->pctl);
 }
[irqchip: irq/irqchip-next] pinctrl: starfive: Move PM device over to irq domain
Posted by irqchip-bot for Marc Zyngier 2 years, 9 months ago
The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     0d872ed9e2148a8ba29de5a71c352fa54abf8e5e
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/0d872ed9e2148a8ba29de5a71c352fa54abf8e5e
Author:        Marc Zyngier <maz@kernel.org>
AuthorDate:    Tue, 01 Feb 2022 12:03:09 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Thu, 10 Feb 2022 11:07:04 

pinctrl: starfive: Move PM device over to irq domain

Move the reference to the device over to the irq domain.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Emil Renner Berthing <kernel@esmil.dk>
Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
Link: https://lore.kernel.org/r/20220201120310.878267-12-maz@kernel.org
---
 drivers/pinctrl/pinctrl-starfive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-starfive.c b/drivers/pinctrl/pinctrl-starfive.c
index 0b91215..5be9866 100644
--- a/drivers/pinctrl/pinctrl-starfive.c
+++ b/drivers/pinctrl/pinctrl-starfive.c
@@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
 	sfp->gc.base = -1;
 	sfp->gc.ngpio = NR_GPIOS;
 
-	starfive_irq_chip.parent_device = dev;
 	starfive_irq_chip.name = sfp->gc.label;
 
 	sfp->gc.irq.chip = &starfive_irq_chip;
@@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "could not register gpiochip\n");
 
+	irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
+
 out_pinctrl_enable:
 	return pinctrl_enable(sfp->pctl);
 }