All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node
@ 2019-05-21 20:03 Simon Goldschmidt
  2019-05-21 20:09 ` Marek Vasut
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Goldschmidt @ 2019-05-21 20:03 UTC (permalink / raw)
  To: u-boot

commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree") introduced
a bug in that dev->node of the gpio chip was accidentally set to the
of_node of its bank subnode.

What it meant to do was assign subdev->node, not dev->node.

While this doesn't affect too many use cases, iterating over the gpio
chip's properties doesn't work any more after that, so fix this.

Fixes: commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree")
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

This fixes a commit that is only 12 days old, so it's a fix for v2019.07

---
 drivers/gpio/dwapb_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index 04a2381acd..d6887a396a 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
 		if (ret)
 			return ret;
 
-		dev->node = node;
+		subdev->node = node;
 		bank++;
 	}
 
-- 
2.20.1

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

* [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node
  2019-05-21 20:03 [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node Simon Goldschmidt
@ 2019-05-21 20:09 ` Marek Vasut
  2019-05-22  8:46   ` Simon Goldschmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2019-05-21 20:09 UTC (permalink / raw)
  To: u-boot

On 5/21/19 10:03 PM, Simon Goldschmidt wrote:
> commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree") introduced
> a bug in that dev->node of the gpio chip was accidentally set to the
> of_node of its bank subnode.
> 
> What it meant to do was assign subdev->node, not dev->node.
> 
> While this doesn't affect too many use cases, iterating over the gpio
> chip's properties doesn't work any more after that, so fix this.
> 
> Fixes: commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree")
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
> This fixes a commit that is only 12 days old, so it's a fix for v2019.07
> 
> ---
>  drivers/gpio/dwapb_gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
> index 04a2381acd..d6887a396a 100644
> --- a/drivers/gpio/dwapb_gpio.c
> +++ b/drivers/gpio/dwapb_gpio.c
> @@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
>  		if (ret)
>  			return ret;
>  
> -		dev->node = node;
> +		subdev->node = node;
>  		bank++;
>  	}
>  
> 
Applied, thanks

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node
  2019-05-21 20:09 ` Marek Vasut
@ 2019-05-22  8:46   ` Simon Goldschmidt
  2019-05-22 11:42     ` Marek Vasut
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Goldschmidt @ 2019-05-22  8:46 UTC (permalink / raw)
  To: u-boot

On Tue, May 21, 2019 at 10:22 PM Marek Vasut <marex@denx.de> wrote:
>
> On 5/21/19 10:03 PM, Simon Goldschmidt wrote:
> > commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree") introduced
> > a bug in that dev->node of the gpio chip was accidentally set to the
> > of_node of its bank subnode.
> >
> > What it meant to do was assign subdev->node, not dev->node.
> >
> > While this doesn't affect too many use cases, iterating over the gpio
> > chip's properties doesn't work any more after that, so fix this.
> >
> > Fixes: commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree")
> > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > ---
> >
> > This fixes a commit that is only 12 days old, so it's a fix for v2019.07
> >
> > ---
> >  drivers/gpio/dwapb_gpio.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
> > index 04a2381acd..d6887a396a 100644
> > --- a/drivers/gpio/dwapb_gpio.c
> > +++ b/drivers/gpio/dwapb_gpio.c
> > @@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
> >               if (ret)
> >                       return ret;
> >
> > -             dev->node = node;
> > +             subdev->node = node;
> >               bank++;
> >       }
> >
> >
> Applied, thanks

Looking around 'include/dm/device-internal.h', I just saw that a more
appropriate fix would be to use 'device_bind_ofnode()' instead of calling
'device_bind()' and assigning the node ourself by accessing subdev->node.

Do you want me to send a follow-up or a v2 of this, given that you already
applied this v1?

Regards,
Simon

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

* [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node
  2019-05-22  8:46   ` Simon Goldschmidt
@ 2019-05-22 11:42     ` Marek Vasut
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2019-05-22 11:42 UTC (permalink / raw)
  To: u-boot

On 5/22/19 10:46 AM, Simon Goldschmidt wrote:
> On Tue, May 21, 2019 at 10:22 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 5/21/19 10:03 PM, Simon Goldschmidt wrote:
>>> commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree") introduced
>>> a bug in that dev->node of the gpio chip was accidentally set to the
>>> of_node of its bank subnode.
>>>
>>> What it meant to do was assign subdev->node, not dev->node.
>>>
>>> While this doesn't affect too many use cases, iterating over the gpio
>>> chip's properties doesn't work any more after that, so fix this.
>>>
>>> Fixes: commit 1b898ffc040b ("gpio: dwapb_gpio: convert to livetree")
>>> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
>>> ---
>>>
>>> This fixes a commit that is only 12 days old, so it's a fix for v2019.07
>>>
>>> ---
>>>  drivers/gpio/dwapb_gpio.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
>>> index 04a2381acd..d6887a396a 100644
>>> --- a/drivers/gpio/dwapb_gpio.c
>>> +++ b/drivers/gpio/dwapb_gpio.c
>>> @@ -190,7 +190,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
>>>               if (ret)
>>>                       return ret;
>>>
>>> -             dev->node = node;
>>> +             subdev->node = node;
>>>               bank++;
>>>       }
>>>
>>>
>> Applied, thanks
> 
> Looking around 'include/dm/device-internal.h', I just saw that a more
> appropriate fix would be to use 'device_bind_ofnode()' instead of calling
> 'device_bind()' and assigning the node ourself by accessing subdev->node.
> 
> Do you want me to send a follow-up or a v2 of this, given that you already
> applied this v1?

Send a follow up patch, I will squash them.

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node
  2019-05-23 18:43 Simon Goldschmidt
@ 2019-05-23 22:00 ` Marek Vasut
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2019-05-23 22:00 UTC (permalink / raw)
  To: u-boot

On 5/23/19 8:43 PM, Simon Goldschmidt wrote:
> commit 1b898ff ("gpio: dwapb_gpio: convert to livetree") introduced
> a bug in that dev->node of the gpio chip was accidentally set to the
> of_node of its bank subnode.
> 
> What it meant to do was assign subdev->node, not dev->node.
> 
> While this doesn't affect too many use cases, iterating over the gpio
> chip's properties doesn't work any more after that, so fix this
> properly by calling 'device_bind_ofnode()' to bind the sub-device
> instead of calling 'device_bind()' and then assigning subdev->node
> manually.
> 
> Fixes: commit 1b898ff ("gpio: dwapb_gpio: convert to livetree")
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
> This applies on top of 0aec330931c5 in u-boot-socfpga/master which it
> should be squashed into.
> ---
>  drivers/gpio/dwapb_gpio.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
> index d6887a396a..2eb1547b4f 100644
> --- a/drivers/gpio/dwapb_gpio.c
> +++ b/drivers/gpio/dwapb_gpio.c
> @@ -185,12 +185,11 @@ static int gpio_dwapb_bind(struct udevice *dev)
>  			plat->name = ofnode_get_name(node);
>  		}
>  
> -		ret = device_bind(dev, dev->driver, plat->name,
> -				  plat, -1, &subdev);
> +		ret = device_bind_ofnode(dev, dev->driver, plat->name,
> +					 plat, node, &subdev);
>  		if (ret)
>  			return ret;
>  
> -		subdev->node = node;
>  		bank++;
>  	}
>  
> 
Applied, thanks

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node
@ 2019-05-23 18:43 Simon Goldschmidt
  2019-05-23 22:00 ` Marek Vasut
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Goldschmidt @ 2019-05-23 18:43 UTC (permalink / raw)
  To: u-boot

commit 1b898ff ("gpio: dwapb_gpio: convert to livetree") introduced
a bug in that dev->node of the gpio chip was accidentally set to the
of_node of its bank subnode.

What it meant to do was assign subdev->node, not dev->node.

While this doesn't affect too many use cases, iterating over the gpio
chip's properties doesn't work any more after that, so fix this
properly by calling 'device_bind_ofnode()' to bind the sub-device
instead of calling 'device_bind()' and then assigning subdev->node
manually.

Fixes: commit 1b898ff ("gpio: dwapb_gpio: convert to livetree")
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

This applies on top of 0aec330931c5 in u-boot-socfpga/master which it
should be squashed into.
---
 drivers/gpio/dwapb_gpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index d6887a396a..2eb1547b4f 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -185,12 +185,11 @@ static int gpio_dwapb_bind(struct udevice *dev)
 			plat->name = ofnode_get_name(node);
 		}
 
-		ret = device_bind(dev, dev->driver, plat->name,
-				  plat, -1, &subdev);
+		ret = device_bind_ofnode(dev, dev->driver, plat->name,
+					 plat, node, &subdev);
 		if (ret)
 			return ret;
 
-		subdev->node = node;
 		bank++;
 	}
 
-- 
2.20.1

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

end of thread, other threads:[~2019-05-23 22:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 20:03 [U-Boot] [PATCH] gpio: dwapb_gpio: fix broken dev->node Simon Goldschmidt
2019-05-21 20:09 ` Marek Vasut
2019-05-22  8:46   ` Simon Goldschmidt
2019-05-22 11:42     ` Marek Vasut
2019-05-23 18:43 Simon Goldschmidt
2019-05-23 22:00 ` Marek Vasut

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.