All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/8] ARM: mvebu: make use of of_find_matching_node_and_match
Date: Tue, 11 Feb 2014 18:31:33 +0100	[thread overview]
Message-ID: <52FA5E75.7030402@free-electrons.com> (raw)
In-Reply-To: <20140211181048.6934bdd3@skate>

On 11/02/2014 18:10, Thomas Petazzoni wrote:
> Dear Jason Cooper,
> 
> On Tue, 11 Feb 2014 11:53:14 -0500, Jason Cooper wrote:
> 
>>> -	np = of_find_matching_node(NULL, of_system_controller_table);
>>> +	np = of_find_matching_node_and_match(NULL, of_system_controller_table,
>>> +					     &match);
>>>  	if (np) {
>>> -		const struct of_device_id *match =
>>> -		    of_match_node(of_system_controller_table, np);
>>
>>
>>> -		BUG_ON(!match);
>>
>> Gregory, is it ok to remove this?  It was added with the original code
>> submission for mach-mvebu.  mvebu_restart() will handle this
>> gracefully...
> 
> The BUG_ON here can normally never be reached. If
> of_find_matching_node() returns a non-NULL result, then of_match_node()
> should also return a non-NULL result.
> 
> Or I'm missing something :)

No you're almost right!

The only case we can get it, would be if we were declaring something like:

static struct of_device_id of_system_controller_table[] = {
	{
		.compatible = "foo,bar-controller",
	},
[...]

instead of

static struct of_device_id of_system_controller_table[] = {
	{
		.compatible = "foo,bar",
		.data = (void *) &bar_controller,
	},
[...]

This test is very paranoid, so I agree to remove it.


Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


Thanks,

Gregory


> 
> Thomas
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Cc: Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 4/8] ARM: mvebu: make use of of_find_matching_node_and_match
Date: Tue, 11 Feb 2014 18:31:33 +0100	[thread overview]
Message-ID: <52FA5E75.7030402@free-electrons.com> (raw)
In-Reply-To: <20140211181048.6934bdd3@skate>

On 11/02/2014 18:10, Thomas Petazzoni wrote:
> Dear Jason Cooper,
> 
> On Tue, 11 Feb 2014 11:53:14 -0500, Jason Cooper wrote:
> 
>>> -	np = of_find_matching_node(NULL, of_system_controller_table);
>>> +	np = of_find_matching_node_and_match(NULL, of_system_controller_table,
>>> +					     &match);
>>>  	if (np) {
>>> -		const struct of_device_id *match =
>>> -		    of_match_node(of_system_controller_table, np);
>>
>>
>>> -		BUG_ON(!match);
>>
>> Gregory, is it ok to remove this?  It was added with the original code
>> submission for mach-mvebu.  mvebu_restart() will handle this
>> gracefully...
> 
> The BUG_ON here can normally never be reached. If
> of_find_matching_node() returns a non-NULL result, then of_match_node()
> should also return a non-NULL result.
> 
> Or I'm missing something :)

No you're almost right!

The only case we can get it, would be if we were declaring something like:

static struct of_device_id of_system_controller_table[] = {
	{
		.compatible = "foo,bar-controller",
	},
[...]

instead of

static struct of_device_id of_system_controller_table[] = {
	{
		.compatible = "foo,bar",
		.data = (void *) &bar_controller,
	},
[...]

This test is very paranoid, so I agree to remove it.


Acked-by: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>


Thanks,

Gregory


> 
> Thomas
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Jason Cooper <jason@lakedaemon.net>
Cc: Josh Cartwright <joshc@codeaurora.org>,
	Andrew Lunn <andrew@lunn.ch>,
	Russell King <linux@arm.linux.org.uk>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH 4/8] ARM: mvebu: make use of of_find_matching_node_and_match
Date: Tue, 11 Feb 2014 18:31:33 +0100	[thread overview]
Message-ID: <52FA5E75.7030402@free-electrons.com> (raw)
In-Reply-To: <20140211181048.6934bdd3@skate>

On 11/02/2014 18:10, Thomas Petazzoni wrote:
> Dear Jason Cooper,
> 
> On Tue, 11 Feb 2014 11:53:14 -0500, Jason Cooper wrote:
> 
>>> -	np = of_find_matching_node(NULL, of_system_controller_table);
>>> +	np = of_find_matching_node_and_match(NULL, of_system_controller_table,
>>> +					     &match);
>>>  	if (np) {
>>> -		const struct of_device_id *match =
>>> -		    of_match_node(of_system_controller_table, np);
>>
>>
>>> -		BUG_ON(!match);
>>
>> Gregory, is it ok to remove this?  It was added with the original code
>> submission for mach-mvebu.  mvebu_restart() will handle this
>> gracefully...
> 
> The BUG_ON here can normally never be reached. If
> of_find_matching_node() returns a non-NULL result, then of_match_node()
> should also return a non-NULL result.
> 
> Or I'm missing something :)

No you're almost right!

The only case we can get it, would be if we were declaring something like:

static struct of_device_id of_system_controller_table[] = {
	{
		.compatible = "foo,bar-controller",
	},
[...]

instead of

static struct of_device_id of_system_controller_table[] = {
	{
		.compatible = "foo,bar",
		.data = (void *) &bar_controller,
	},
[...]

This test is very paranoid, so I agree to remove it.


Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


Thanks,

Gregory


> 
> Thomas
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2014-02-11 17:31 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 16:23 [PATCH 0/8] of_find_matching_node/of_match_node -> of_find_matching_node_and_match Josh Cartwright
2014-02-11 16:23 ` Josh Cartwright
2014-02-11 16:23 ` [PATCH 1/8] bus: arm-cci: make use of of_find_matching_node_and_match Josh Cartwright
2014-02-11 16:23   ` Josh Cartwright
2014-02-11 16:23   ` Josh Cartwright
2014-02-11 16:24 ` [PATCH 2/8] bus: mvebu-mbus: " Josh Cartwright
2014-02-11 16:24   ` Josh Cartwright
2014-02-11 16:39   ` Jason Cooper
2014-02-11 16:39     ` Jason Cooper
2014-02-11 16:39     ` Jason Cooper
2014-02-11 19:22   ` Jason Cooper
2014-02-11 19:22     ` Jason Cooper
2014-02-11 16:24 ` [PATCH 3/8] ARM: at91: " Josh Cartwright
2014-02-11 16:24   ` Josh Cartwright
2014-02-11 17:46   ` Nicolas Ferre
2014-02-11 17:46     ` Nicolas Ferre
2014-02-11 17:46     ` Nicolas Ferre
2014-02-11 18:44     ` Josh Cartwright
2014-02-11 18:44       ` Josh Cartwright
2014-02-11 18:44       ` Josh Cartwright
2014-02-11 16:24 ` [PATCH 4/8] ARM: mvebu: " Josh Cartwright
2014-02-11 16:24   ` Josh Cartwright
2014-02-11 16:24   ` Josh Cartwright
2014-02-11 16:41   ` Thomas Petazzoni
2014-02-11 16:41     ` Thomas Petazzoni
2014-02-11 16:41     ` Thomas Petazzoni
2014-02-11 16:53   ` Jason Cooper
2014-02-11 16:53     ` Jason Cooper
2014-02-11 16:53     ` Jason Cooper
2014-02-11 17:10     ` Thomas Petazzoni
2014-02-11 17:10       ` Thomas Petazzoni
2014-02-11 17:10       ` Thomas Petazzoni
2014-02-11 17:31       ` Gregory CLEMENT [this message]
2014-02-11 17:31         ` Gregory CLEMENT
2014-02-11 17:31         ` Gregory CLEMENT
2014-02-11 17:34         ` Jason Cooper
2014-02-11 17:34           ` Jason Cooper
2014-02-11 17:34           ` Jason Cooper
2014-02-11 17:43           ` Josh Cartwright
2014-02-11 17:43             ` Josh Cartwright
2014-02-11 19:29   ` Jason Cooper
2014-02-11 19:29     ` Jason Cooper
2014-02-11 16:24 ` [PATCH 5/8] ARM: prima2: " Josh Cartwright
2014-02-11 16:24   ` Josh Cartwright
2014-02-11 16:24 ` [PATCH 6/8] ARM: l2x0: " Josh Cartwright
2014-02-11 16:24   ` Josh Cartwright
2014-02-11 16:24 ` [PATCH 7/8] C6X: " Josh Cartwright
2014-02-11 16:24 ` [PATCH 8/8] cpufreq: ppc: " Josh Cartwright
2014-02-12  5:01   ` Viresh Kumar

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=52FA5E75.7030402@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.