Re: [PATCH v4 0/4] Bugfix for of_match_node ordering

2014-02-20 Thread Kevin Hao
On Thu, Feb 20, 2014 at 03:57:07PM +0530, Sachin Kamat wrote: > Hi Kevin, > > On 20 February 2014 15:42, Kevin Hao wrote: > > On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote: > >> Hi Grant, > >> > >> I observe the following boot failure wit

Re: [PATCH v4 0/4] Bugfix for of_match_node ordering

2014-02-20 Thread Kevin Hao
On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote: > Hi Grant, > > I observe the following boot failure with today's (next-20140220) linux-next > tree on Exynos based boards with the default exynos_defconfig. Does this help? diff --git a/drivers/of/base.c b/drivers/of/base.c index 8a2

[PATCH v3 2/4] of: reimplement the matching method for __of_match_node()

2014-02-19 Thread Kevin Hao
type 11. name This is based on some pseudo-codes provided by Grant Likely. Signed-off-by: Kevin Hao [grant.likely: Changed multiplier to 4 which makes more sense] Signed-off-by: Grant Likely --- v3: Also need to bail out when there does have a compatible member in match entry, but it does

Re: [PATCH v2 2/4] of: reimplement the matching method for __of_match_node()

2014-02-18 Thread Kevin Hao
On Wed, Feb 19, 2014 at 02:21:02PM +0800, Kevin Hao wrote: > + /* > + * Matching compatible is better than matching type and name, > + * and the specific compatible is better than the general. > + */ > + if (matche

Re: [PATCH 4/4] of: Add self test for of_match_node()

2014-02-18 Thread Kevin Hao
On Tue, Feb 18, 2014 at 10:31:20PM +, Grant Likely wrote: > Adds a selftest function for the of_match_node function. of_match_node > is supposed to handle precedence for the compatible property as well as > the name and device_type values. This patch adds some test case data and > a function th

[PATCH v2 2/4] of: reimplement the matching method for __of_match_node()

2014-02-18 Thread Kevin Hao
type 11. name This is based on some pseudo-codes provided by Grant Likely. Signed-off-by: Kevin Hao [grant.likely: Changed multiplier to 4 which makes more sense] Signed-off-by: Grant Likely --- v2: Fix the bug such as we get the same score for the following two match entries: name2 {

Re: [PATCH 2/2] of: reimplement the matching method for __of_match_node()

2014-02-18 Thread Kevin Hao
On Tue, Feb 18, 2014 at 10:29:18PM +, Grant Likely wrote: > On Tue, 18 Feb 2014 15:57:30 +0800, Kevin Hao wrote: > > In the current implementation of __of_match_node(), it will compare > > each given match entry against all the node's compatible strings > > wi

[PATCH 1/2] Revert "of: search the best compatible match first in __of_match_node()"

2014-02-18 Thread Kevin Hao
compatible string. So revert this and we will implement another method to find the best match entry. Signed-off-by: Kevin Hao --- drivers/of/base.c | 43 +-- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index

[PATCH 2/2] of: reimplement the matching method for __of_match_node()

2014-02-18 Thread Kevin Hao
type 11. name This is based on some pseudo-codes provided by Grant Likely. Signed-off-by: Kevin Hao --- drivers/of/base.c | 87 +++ 1 file changed, 68 insertions(+), 19 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index ba19

[PATCH 0/2] of: reimplement the matching method for __of_match_node()

2014-02-17 Thread Kevin Hao
This implemented the matching method for __of_match_node() suggested by Grant Likely. You can find more detail at: http://patchwork.ozlabs.org/patch/320286/ Kevin Hao (2): Revert "of: search the best compatible match first in __of_match_node()" of: reimplement the matching

Re: [PATCH 2/2] of: search the best compatible match first in __of_match_node()

2014-02-17 Thread Kevin Hao
On Mon, Feb 17, 2014 at 05:58:34PM +, Grant Likely wrote: > This seems wrong also. The compatible order should be checked for even > when m->name or m->type are set. You actually need to score the entries > to do this properly. The pseudo-code should look like this: > > uint best_score = ~0;

[PATCH 0/2] of: fix a regression when trying to find the best compatible match

2014-02-13 Thread Kevin Hao
/patch/319624/ This is another respin with the implementation suggested by Rob Herring. Kevin Hao (2): Revert "OF: base: match each node compatible against all given matches first" of: search the best compatible match first in __of_match_node() drivers/of/b

[PATCH 2/2] of: search the best compatible match first in __of_match_node()

2014-02-13 Thread Kevin Hao
hat node's compatibles are ordered from specific to generic while given matches can be in any order. If we fail to find such a match entry, then fall-back to the old method in order to keep compatibility. Cc: Sebastian Hesselbarth Signed-off-by: Kevin Hao --- drivers

[PATCH 1/2] Revert "OF: base: match each node compatible against all given matches first"

2014-02-13 Thread Kevin Hao
uot;ns16850", .data = (void *)PORT_16850, }, ... { .type = "serial", .data = (void *)PORT_UNKNOWN, }, { /* end of list */ }, }; So just revert this patch, we will use another implementation to find the best compatible match

Re: [PATCH] of: give priority to the compatible match in __of_match_node()

2014-02-13 Thread Kevin Hao
On Thu, Feb 13, 2014 at 01:01:42PM -0600, Rob Herring wrote: > On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao wrote: > > When the device node do have a compatible property, we definitely > > prefer the compatible match besides the type and name. Only if > > there is no such a ma

[PATCH] of: give priority to the compatible match in __of_match_node()

2014-02-12 Thread Kevin Hao
on a patch from Sebastian Hesselbarth. http://patchwork.ozlabs.org/patch/319434/ I did some code refactoring and also fixed a bug in the original patch. Cc: Sebastian Hesselbarth Signed-off-by: Kevin Hao --- drivers/of/base.c | 55 +-- 1 file ch

Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Kevin Hao
On Wed, Feb 12, 2014 at 12:26:14PM +0100, Sebastian Hesselbarth wrote: > You can cook it down to: > > m = matches; > /* Check against matches without compatible string */ > while (m->name[0] || m->type[0] || m->compatible[0]) { > if (!m->compatible[0] && of_match_ty

Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Kevin Hao
On Wed, Feb 12, 2014 at 09:25:24AM +0100, Sebastian Hesselbarth wrote: > > Hmm, I did a mistake in the patch: > > - while (m->name[0] || m->type[0]) { > + while (m->compatible[0] || m->name[0] || m->type[0]) { > > for the second added match. Otherwise, the matches are not > evaluated dow

Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-12 Thread Kevin Hao
On Wed, Feb 12, 2014 at 09:30:00AM +0100, Sebastian Hesselbarth wrote: > On 02/12/2014 06:28 AM, Kevin Hao wrote: > >On Wed, Feb 12, 2014 at 10:21:58AM +1000, Stephen N Chivers wrote: > >>But, the Interrupt Controller (MPIC) > >>goes AWOL and it is down hill from

Re: Linux-3.14-rc2: Order of serial node compatibles in DTS files.

2014-02-11 Thread Kevin Hao
On Wed, Feb 12, 2014 at 10:21:58AM +1000, Stephen N Chivers wrote: > But, the Interrupt Controller (MPIC) > goes AWOL and it is down hill from there. > > The MPIC is specified in the DTS as: > > mpic: pic@4 { > interrupt-controller; > #a