All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Mark Yao <mark.yao@rock-chips.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	David Airlie <airlied@linux.ie>, Eric Anholt <eric@anholt.net>,
	linux-rockchip <linux-rockchip@lists.infradead.org>,
	LAKML <linux-arm-kernel@lists.infradead.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] drm/rockchip: Convert the probe function to the generic drm_of_component_probe()
Date: Mon, 16 Nov 2015 18:01:30 +0100	[thread overview]
Message-ID: <1568703.PCC29q0Px2@diego> (raw)
In-Reply-To: <20151116165206.GC4158@e106497-lin.cambridge.arm.com>

Am Montag, 16. November 2015, 16:52:06 schrieb Liviu Dudau:
> On Mon, Nov 16, 2015 at 04:30:16PM +0000, Russell King - ARM Linux wrote:
> > I've tweaked your patch to make the above (buggy) change a little clearer.
> > 
> > On Mon, Nov 16, 2015 at 02:44:53PM +0000, Liviu Dudau wrote:
> > > -	for (i = 0;; i++) {
> > > -		port = of_parse_phandle(np, "ports", i);
> > > -		if (!port)
> > > -			break;
> > > -
> > > -		if (!of_device_is_available(port->parent)) {
> > > -			of_node_put(port);
> > > -			continue;
> > > -		}
> > > 
> > > -		component_match_add(dev, &match, compare_of, port->parent);
> > > -		of_node_put(port);
> > > -	}
> > > 
> > > -static int compare_of(struct device *dev, void *data)
> > > -{
> > > -	struct device_node *np = data;
> > > -
> > > -	return dev->of_node == np;
> > > -}
> > 
> > The original above passes port->parent to component_match_add().  This
> > means 'np' in the above compare_of() function is 'port->parent'.
> > 
> > This means the above comparison is effectively:
> > 	dev->of_node == port->parent
> > 
> > The generic code instead does this:
> >                 component_match_add(dev, &match, compare_of, port);
> > 
> > So what we get in the comparison function is 'port' rather than
> > 
> > 'port->parent':
> > > +static int compare_port(struct device *dev, void *data)
> > > 
> > >  {
> > > 
> > > +	struct device_node *np = data;
> > > +	return dev->parent->of_node == np;
> > > +}
> > 
> > which means the comparison is:
> > 	dev->parent->of_node == port
> > 
> > which is a different comparison from the above.
> > 
> > You instead want this to be:
> > 	return dev->of_node == np->parent;
> > 
> > Heiko, please test the above change to compare_port() - I think you'll
> > find that will fix your issue.
> 
> Sorry, I admit I'm not very good at doing patches without being able
> to test them. :(
> 
> Thanks for helping on this!

Russell's hint was correct. With the compare function changed like he pointed 
out, I again get a working display with your patches :-)

So, thanks Russell for spotting this.


Heiko

WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: Liviu Dudau <Liviu.Dudau-5wv7dgnIgG8@public.gmane.org>
Cc: Russell King - ARM Linux
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	linux-rockchip
	<linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	dri-devel
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>,
	Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	LAKML
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	Mark Yao <mark.yao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Subject: Re: [PATCH 2/2] drm/rockchip: Convert the probe function to the generic drm_of_component_probe()
Date: Mon, 16 Nov 2015 18:01:30 +0100	[thread overview]
Message-ID: <1568703.PCC29q0Px2@diego> (raw)
In-Reply-To: <20151116165206.GC4158-2JSQmVVBSi7ZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>

Am Montag, 16. November 2015, 16:52:06 schrieb Liviu Dudau:
> On Mon, Nov 16, 2015 at 04:30:16PM +0000, Russell King - ARM Linux wrote:
> > I've tweaked your patch to make the above (buggy) change a little clearer.
> > 
> > On Mon, Nov 16, 2015 at 02:44:53PM +0000, Liviu Dudau wrote:
> > > -	for (i = 0;; i++) {
> > > -		port = of_parse_phandle(np, "ports", i);
> > > -		if (!port)
> > > -			break;
> > > -
> > > -		if (!of_device_is_available(port->parent)) {
> > > -			of_node_put(port);
> > > -			continue;
> > > -		}
> > > 
> > > -		component_match_add(dev, &match, compare_of, port->parent);
> > > -		of_node_put(port);
> > > -	}
> > > 
> > > -static int compare_of(struct device *dev, void *data)
> > > -{
> > > -	struct device_node *np = data;
> > > -
> > > -	return dev->of_node == np;
> > > -}
> > 
> > The original above passes port->parent to component_match_add().  This
> > means 'np' in the above compare_of() function is 'port->parent'.
> > 
> > This means the above comparison is effectively:
> > 	dev->of_node == port->parent
> > 
> > The generic code instead does this:
> >                 component_match_add(dev, &match, compare_of, port);
> > 
> > So what we get in the comparison function is 'port' rather than
> > 
> > 'port->parent':
> > > +static int compare_port(struct device *dev, void *data)
> > > 
> > >  {
> > > 
> > > +	struct device_node *np = data;
> > > +	return dev->parent->of_node == np;
> > > +}
> > 
> > which means the comparison is:
> > 	dev->parent->of_node == port
> > 
> > which is a different comparison from the above.
> > 
> > You instead want this to be:
> > 	return dev->of_node == np->parent;
> > 
> > Heiko, please test the above change to compare_port() - I think you'll
> > find that will fix your issue.
> 
> Sorry, I admit I'm not very good at doing patches without being able
> to test them. :(
> 
> Thanks for helping on this!

Russell's hint was correct. With the compare function changed like he pointed 
out, I again get a working display with your patches :-)

So, thanks Russell for spotting this.


Heiko

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] drm/rockchip: Convert the probe function to the generic drm_of_component_probe()
Date: Mon, 16 Nov 2015 18:01:30 +0100	[thread overview]
Message-ID: <1568703.PCC29q0Px2@diego> (raw)
In-Reply-To: <20151116165206.GC4158@e106497-lin.cambridge.arm.com>

Am Montag, 16. November 2015, 16:52:06 schrieb Liviu Dudau:
> On Mon, Nov 16, 2015 at 04:30:16PM +0000, Russell King - ARM Linux wrote:
> > I've tweaked your patch to make the above (buggy) change a little clearer.
> > 
> > On Mon, Nov 16, 2015 at 02:44:53PM +0000, Liviu Dudau wrote:
> > > -	for (i = 0;; i++) {
> > > -		port = of_parse_phandle(np, "ports", i);
> > > -		if (!port)
> > > -			break;
> > > -
> > > -		if (!of_device_is_available(port->parent)) {
> > > -			of_node_put(port);
> > > -			continue;
> > > -		}
> > > 
> > > -		component_match_add(dev, &match, compare_of, port->parent);
> > > -		of_node_put(port);
> > > -	}
> > > 
> > > -static int compare_of(struct device *dev, void *data)
> > > -{
> > > -	struct device_node *np = data;
> > > -
> > > -	return dev->of_node == np;
> > > -}
> > 
> > The original above passes port->parent to component_match_add().  This
> > means 'np' in the above compare_of() function is 'port->parent'.
> > 
> > This means the above comparison is effectively:
> > 	dev->of_node == port->parent
> > 
> > The generic code instead does this:
> >                 component_match_add(dev, &match, compare_of, port);
> > 
> > So what we get in the comparison function is 'port' rather than
> > 
> > 'port->parent':
> > > +static int compare_port(struct device *dev, void *data)
> > > 
> > >  {
> > > 
> > > +	struct device_node *np = data;
> > > +	return dev->parent->of_node == np;
> > > +}
> > 
> > which means the comparison is:
> > 	dev->parent->of_node == port
> > 
> > which is a different comparison from the above.
> > 
> > You instead want this to be:
> > 	return dev->of_node == np->parent;
> > 
> > Heiko, please test the above change to compare_port() - I think you'll
> > find that will fix your issue.
> 
> Sorry, I admit I'm not very good at doing patches without being able
> to test them. :(
> 
> Thanks for helping on this!

Russell's hint was correct. With the compare function changed like he pointed 
out, I again get a working display with your patches :-)

So, thanks Russell for spotting this.


Heiko

  reply	other threads:[~2015-11-16 17:02 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 14:44 [PATCH 0/2] Improve drm_of_component_probe() and move rockchip to use it Liviu Dudau
2015-11-16 14:44 ` Liviu Dudau
2015-11-16 14:44 ` Liviu Dudau
2015-11-16 14:44 ` [PATCH 1/2] drm: Improve drm_of_component_probe() to correctly handle ports and remote ports Liviu Dudau
2015-11-16 14:44   ` Liviu Dudau
2015-11-16 14:44   ` Liviu Dudau
2015-11-16 16:22   ` Russell King - ARM Linux
2015-11-16 16:22     ` Russell King - ARM Linux
2015-11-16 16:22     ` Russell King - ARM Linux
2015-11-16 16:49     ` Liviu Dudau
2015-11-16 16:49       ` Liviu Dudau
2015-11-16 17:22       ` Russell King - ARM Linux
2015-11-16 17:22         ` Russell King - ARM Linux
2015-11-16 17:22         ` Russell King - ARM Linux
2015-11-16 17:32         ` Daniel Stone
2015-11-16 17:32           ` Daniel Stone
2015-11-16 17:32           ` Daniel Stone
2015-11-16 17:43           ` Russell King - ARM Linux
2015-11-16 17:43             ` Russell King - ARM Linux
2015-11-16 17:43             ` Russell King - ARM Linux
2015-11-16 17:48             ` Daniel Stone
2015-11-16 17:48               ` Daniel Stone
2015-11-16 17:48               ` Daniel Stone
2015-11-16 17:53               ` Russell King - ARM Linux
2015-11-16 17:53                 ` Russell King - ARM Linux
2015-11-16 21:17         ` Liviu Dudau
2015-11-16 21:17           ` Liviu Dudau
2015-11-16 21:17           ` Liviu Dudau
2015-11-16 22:33           ` Russell King - ARM Linux
2015-11-16 22:33             ` Russell King - ARM Linux
2015-11-16 14:44 ` [PATCH 2/2] drm/rockchip: Convert the probe function to the generic drm_of_component_probe() Liviu Dudau
2015-11-16 14:44   ` Liviu Dudau
2015-11-16 14:44   ` Liviu Dudau
2015-11-16 16:30   ` Russell King - ARM Linux
2015-11-16 16:30     ` Russell King - ARM Linux
2015-11-16 16:30     ` Russell King - ARM Linux
2015-11-16 16:52     ` Liviu Dudau
2015-11-16 16:52       ` Liviu Dudau
2015-11-16 16:52       ` Liviu Dudau
2015-11-16 17:01       ` Heiko Stübner [this message]
2015-11-16 17:01         ` Heiko Stübner
2015-11-16 17:01         ` Heiko Stübner
2015-11-16 16:07 ` [PATCH 0/2] Improve drm_of_component_probe() and move rockchip to use it Heiko Stübner
2015-11-16 16:07   ` Heiko Stübner
2015-11-16 16:07   ` Heiko Stübner
2015-11-16 16:50   ` Liviu Dudau
2015-11-16 16:50     ` Liviu Dudau
2015-11-16 16:50     ` Liviu Dudau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568703.PCC29q0Px2@diego \
    --to=heiko@sntech.de \
    --cc=Liviu.Dudau@arm.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.yao@rock-chips.com \
    --cc=p.zabel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.