All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'
@ 2020-12-06 10:53 Sergio Paracuellos
  2020-12-07 13:05 ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Sergio Paracuellos @ 2020-12-06 10:53 UTC (permalink / raw)
  To: gregkh; +Cc: hackpascal, devel, linus.walleij, yanaijie

If the gpio DT node has the 'gpio-ranges' property, the range will be
added by the gpio core and doesn't need to be added by the pinctrl
driver.

By having the gpio-ranges property, we can map every pin between
gpio node and pinctrl node and we can stop using the deprecated
pinctrl_add_gpio_range() function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/mt7621-dts/mt7621.dtsi        |  1 +
 .../staging/mt7621-pinctrl/pinctrl-rt2880.c   | 29 -------------------
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi b/drivers/staging/mt7621-dts/mt7621.dtsi
index 82aa93634eda..5b9d3bf82cb1 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -90,6 +90,7 @@ gpio: gpio@600 {
 			#interrupt-cells = <2>;
 			compatible = "mediatek,mt7621-gpio";
 			gpio-controller;
+			gpio-ranges = <&pinctrl 0 0 95>;
 			interrupt-controller;
 			reg = <0x600 0x100>;
 			interrupt-parent = <&gic>;
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index caaf9e34f1ee..e61dbe186bc9 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -318,7 +318,6 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
 {
 	struct rt2880_priv *p;
 	struct pinctrl_dev *dev;
-	struct device_node *np;
 
 	if (!rt2880_pinmux_data)
 		return -ENOTSUPP;
@@ -346,34 +345,6 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
 	if (IS_ERR(dev))
 		return PTR_ERR(dev);
 
-	/* finalize by adding gpio ranges for enables gpio controllers */
-	for_each_compatible_node(np, NULL, "ralink,rt2880-gpio") {
-		const __be32 *ngpio, *gpiobase;
-		struct pinctrl_gpio_range *range;
-
-		if (!of_device_is_available(np))
-			continue;
-
-		ngpio = of_get_property(np, "ralink,num-gpios", NULL);
-		gpiobase = of_get_property(np, "ralink,gpio-base", NULL);
-		if (!ngpio || !gpiobase) {
-			dev_err(&pdev->dev, "failed to load chip info\n");
-			of_node_put(np);
-			return -EINVAL;
-		}
-
-		range = devm_kzalloc(p->dev, sizeof(*range), GFP_KERNEL);
-		if (!range) {
-			of_node_put(np);
-			return -ENOMEM;
-		}
-		range->name = "pio";
-		range->npins = __be32_to_cpu(*ngpio);
-		range->base = __be32_to_cpu(*gpiobase);
-		range->pin_base = range->base;
-		pinctrl_add_gpio_range(dev, range);
-	}
-
 	return 0;
 }
 
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'
  2020-12-06 10:53 [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range' Sergio Paracuellos
@ 2020-12-07 13:05 ` Linus Walleij
  2020-12-07 13:57   ` Sergio Paracuellos
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2020-12-07 13:05 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: hackpascal, Greg KH, devel, Jason Yan

On Sun, Dec 6, 2020 at 11:53 AM Sergio Paracuellos
<sergio.paracuellos@gmail.com> wrote:

> If the gpio DT node has the 'gpio-ranges' property, the range will be
> added by the gpio core and doesn't need to be added by the pinctrl
> driver.
>
> By having the gpio-ranges property, we can map every pin between
> gpio node and pinctrl node and we can stop using the deprecated
> pinctrl_add_gpio_range() function.
>
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

After this I think the driver looks good and can graduate from staging.
Can you send a patch to move this to drivers/pinctrl next?

I think drivers/pinctrl/pinctrl-rt2880.c since we don't expect a lot
more of them.

Yours,
Linus Walleij
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'
  2020-12-07 13:05 ` Linus Walleij
@ 2020-12-07 13:57   ` Sergio Paracuellos
  2020-12-07 15:40     ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Sergio Paracuellos @ 2020-12-07 13:57 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Weijie Gao, Greg KH, open list:STAGING SUBSYSTEM, Jason Yan

Hi Linus,

On Mon, Dec 7, 2020 at 2:05 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Sun, Dec 6, 2020 at 11:53 AM Sergio Paracuellos
> <sergio.paracuellos@gmail.com> wrote:
>
> > If the gpio DT node has the 'gpio-ranges' property, the range will be
> > added by the gpio core and doesn't need to be added by the pinctrl
> > driver.
> >
> > By having the gpio-ranges property, we can map every pin between
> > gpio node and pinctrl node and we can stop using the deprecated
> > pinctrl_add_gpio_range() function.
> >
> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> After this I think the driver looks good and can graduate from staging.
> Can you send a patch to move this to drivers/pinctrl next

>
> I think drivers/pinctrl/pinctrl-rt2880.c since we don't expect a lot
> more of them.


Perfect, let me write the bindings yaml file and send the patch moving this.

What git tree do you prefer the patch to be rebased onto?

>
> Yours,
> Linus Walleij

Best regards,
    Sergio Paracuellos
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'
  2020-12-07 13:57   ` Sergio Paracuellos
@ 2020-12-07 15:40     ` Linus Walleij
  2020-12-07 15:50       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2020-12-07 15:40 UTC (permalink / raw)
  To: Sergio Paracuellos
  Cc: Weijie Gao, Greg KH, open list:STAGING SUBSYSTEM, Jason Yan

On Mon, Dec 7, 2020 at 2:57 PM Sergio Paracuellos
<sergio.paracuellos@gmail.com> wrote:
> On Mon, Dec 7, 2020 at 2:05 PM Linus Walleij <linus.walleij@linaro.org> wrote:

> > After this I think the driver looks good and can graduate from staging.
> > Can you send a patch to move this to drivers/pinctrl next
> >
> > I think drivers/pinctrl/pinctrl-rt2880.c since we don't expect a lot
> > more of them.
>
> Perfect, let me write the bindings yaml file and send the patch moving this.
>
> What git tree do you prefer the patch to be rebased onto?

I suppose Gregs since he has some changes to it that it need to
be based on. After v5.11-rc1 it could be the pinctrl tree as well.
I don't know if Greg has a favourite way to de-stage drivers?

Yours,
Linus Walleij
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'
  2020-12-07 15:40     ` Linus Walleij
@ 2020-12-07 15:50       ` Greg KH
  2020-12-07 21:43         ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2020-12-07 15:50 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Weijie Gao, open list:STAGING SUBSYSTEM, Jason Yan

On Mon, Dec 07, 2020 at 04:40:06PM +0100, Linus Walleij wrote:
> On Mon, Dec 7, 2020 at 2:57 PM Sergio Paracuellos
> <sergio.paracuellos@gmail.com> wrote:
> > On Mon, Dec 7, 2020 at 2:05 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > > After this I think the driver looks good and can graduate from staging.
> > > Can you send a patch to move this to drivers/pinctrl next
> > >
> > > I think drivers/pinctrl/pinctrl-rt2880.c since we don't expect a lot
> > > more of them.
> >
> > Perfect, let me write the bindings yaml file and send the patch moving this.
> >
> > What git tree do you prefer the patch to be rebased onto?
> 
> I suppose Gregs since he has some changes to it that it need to
> be based on. After v5.11-rc1 it could be the pinctrl tree as well.
> I don't know if Greg has a favourite way to de-stage drivers?

It all depends on what the subsystem maintainer wants to do.

Sometimes we just do a "add a new driver to the real spot" that goes
through the subsystem tree, and when that is accepted, I delete the
driver in the staging tree.  This is most often in networking.

Or you can wait until -rc1 and do a move in your tree, or just tell me
to do the move in my tree with an ack, and I can handle it all.

Whatever is easier for you is fine with me, I'm flexible :)

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'
  2020-12-07 15:50       ` Greg KH
@ 2020-12-07 21:43         ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2020-12-07 21:43 UTC (permalink / raw)
  To: Greg KH; +Cc: Weijie Gao, open list:STAGING SUBSYSTEM, Jason Yan

On Mon, Dec 7, 2020 at 4:49 PM Greg KH <gregkh@linuxfoundation.org> wrote:

> Sometimes we just do a "add a new driver to the real spot" that goes
> through the subsystem tree, and when that is accepted, I delete the
> driver in the staging tree.  This is most often in networking.

That's unnice, it will loose the history, it is so nice to git blame
the source.

> Or you can wait until -rc1 and do a move in your tree, or just tell me
> to do the move in my tree with an ack, and I can handle it all.
>
> Whatever is easier for you is fine with me, I'm flexible :)

I say let's move it to my subsystem before the merge window
if there is time. I'll provide ACK.

Yours,
Linus Walleij
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-07 21:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 10:53 [PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range' Sergio Paracuellos
2020-12-07 13:05 ` Linus Walleij
2020-12-07 13:57   ` Sergio Paracuellos
2020-12-07 15:40     ` Linus Walleij
2020-12-07 15:50       ` Greg KH
2020-12-07 21:43         ` Linus Walleij

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.