Skip to contentSkip to conversation

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

PATCH In review Kevin Hao 6 participants 12 messages Feb 12, 2014 – Feb 20, 2014 7 messages not in the archive Device tree

lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH 1/1 of: give priority to the compatible match in __of_match_node()

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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 <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -18
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+				const struct of_device_id *m)
+{
+	int match = 1;
+
+	if (m->name[0])
+		match &= node->name && !strcmp(m->name, node->name);
+
+	if (m->type[0])
+		match &= node->type && !strcmp(m->type, node->type);
+
+	return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
 					   const struct device_node *node)
 {
 	const char *cp;
 	int cplen, l;
+	const struct of_device_id *m;
+	int match;
 
 	if (!matches)
 		return NULL;
 
 	cp = __of_get_property(node, "compatible", &cplen);
-	do {
-		const struct of_device_id *m = matches;
+	while (cp && (cplen > 0)) {
+		m = matches;
 
 		/* Check against matches with current compatible string */
 		while (m->name[0] || m->type[0] || m->compatible[0]) {
-			int match = 1;
-			if (m->name[0])
-				match &= node->name
-					&& !strcmp(m->name, node->name);
-			if (m->type[0])
-				match &= node->type
-					&& !strcmp(m->type, node->type);
-			if (m->compatible[0])
-				match &= cp
-					&& !of_compat_cmp(m->compatible, cp,
+			if (!m->compatible[0]) {
+				m++;
+				continue;
+			}
+
+			match = of_match_type_or_name(node, m);
+			match &= cp && !of_compat_cmp(m->compatible, cp,
 							strlen(m->compatible));
 			if (match)
 				return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
 		}
 
 		/* Get node's next compatible string */ 
-		if (cp) {
-			l = strlen(cp) + 1;
-			cp += l;
-			cplen -= l;
-		}
-	} while (cp && (cplen > 0));
+		l = strlen(cp) + 1;
+		cp += l;
+		cplen -= l;
+	}
+
+	m = matches;
+	/* Check against matches without compatible string */
+	while (m->name[0] || m->type[0] || m->compatible[0]) {
+		if (!m->compatible[0] && of_match_type_or_name(node, m))
+			return m;
+		m++;
+	}
 
 	return NULL;
 }
Signature · 6 lines
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tested-by Stephen Chivers on v1 1/1
#1 lore raw

Kevin Hao <[email protected]> wrote on 02/12/2014 10:38:04 PM:

Quoted 17 lines

From: Kevin Hao <[email protected]>
To: [email protected], [email protected]
Cc: Sebastian Hesselbarth <[email protected]>, Stephen N Chivers <[email protected]>, Chris Proctor <[email protected]>, Arnd Bergmann <[email protected]>, Scott Wood <[email protected]>, Grant Likely <[email protected]>, Rob Herring <[email protected]>
Date: 02/12/2014 10:38 PM
Subject: [PATCH] of: give priority to the compatible match in __of_match_node()

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

Quoted 7 lines

This is based 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 <[email protected]>

Patch works for both orderings. Platform boots without problems and I get the normal serial console.

Quoted 97 lines
---
 drivers/of/base.c | 55 ++++++++++++++++++++++++++++++++++++
+------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +25 -12
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+            const struct of_device_id *m)
+{
+   int match = 1;
+
+   if (m->name[0])
+      match &= node->name && !strcmp(m->name, node->name);
+
+   if (m->type[0])
+      match &= node->type && !strcmp(m->type, node->type);
+
+   return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct 
 of_device_id *matches,
                   const struct device_node *node)
 {
    const char *cp;
    int cplen, l;
+   const struct of_device_id *m;
+   int match;
 
    if (!matches)
       return NULL;
 
    cp = __of_get_property(node, "compatible", &cplen);
-   do {
-      const struct of_device_id *m = matches;
+   while (cp && (cplen > 0)) {
+      m = matches;
 
       /* Check against matches with current compatible string */
       while (m->name[0] || m->type[0] || m->compatible[0]) {
-         int match = 1;
-         if (m->name[0])
-            match &= node->name
-               && !strcmp(m->name, node->name);
-         if (m->type[0])
-            match &= node->type
-               && !strcmp(m->type, node->type);
-         if (m->compatible[0])
-            match &= cp
-               && !of_compat_cmp(m->compatible, cp,
+         if (!m->compatible[0]) {
+            m++;
+            continue;
+         }
+
+         match = of_match_type_or_name(node, m);
+         match &= cp && !of_compat_cmp(m->compatible, cp,
                      strlen(m->compatible));
          if (match)
             return m;
drivers/of/base.c +12 -6
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node
 (const struct of_device_id *matches,
       }
 
       /* Get node's next compatible string */ 
-      if (cp) {
-         l = strlen(cp) + 1;
-         cp += l;
-         cplen -= l;
-      }
-   } while (cp && (cplen > 0));
+      l = strlen(cp) + 1;
+      cp += l;
+      cplen -= l;
+   }
+
+   m = matches;
+   /* Check against matches without compatible string */
+   while (m->name[0] || m->type[0] || m->compatible[0]) {
+      if (!m->compatible[0] && of_match_type_or_name(node, m))
+         return m;
+      m++;
+   }
 
    return NULL;

}

Signature · 1 line
1.8.5.3

A message that is not in the archive (sent off-list or not yet received): 1392205084-2351-1-git-send-email-haokexin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#3 lore raw
Quoted 10 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

Rob

Quoted 97 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -19
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, node->name);
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, node->type);
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                                           const struct device_node *node)
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current compatible string */
                while (m->name[0] || m->type[0] || m->compatible[0]) {
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, node->name);
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, node->type);
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp(m->compatible, cp,
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && !of_compat_cmp(m->compatible, cp,
                                                        strlen(m->compatible));
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && of_match_type_or_name(node, m))
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAL_JsqKMi2H=vwoxrOt8QRA2xJeiLqBKKfLtt4QRCRoFk6JUHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#5 lore raw
Quoted 15 lines · Rob Herring
Quoted 10 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Quoted 10 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

OK, I will git it a try.

Thanks,
Kevin

#6 lore raw
In reply to a message not in the archive
Quoted 15 lines · Rob Herring
Quoted 10 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Quoted 10 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

I disagree here, partially because it complicates the code and partially because it leaves an incorrect corner case. Compatible is always the preferred matching, even on old drivers, but there are bindings that take both compatible and type or name into account. Even those cases should rank the compatible order.

g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
In reply to a message not in the archive
Quoted 7 lines · Rob Herring
Quoted 6 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

Quoted 7 lines
Quoted 4 lines

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548. It fails with:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will compare each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered from specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

Quoted 111 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

Rob

Quoted 97 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -19
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, node->name);
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, node->type);
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                                           const struct device_node *node)
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current compatible string */
                while (m->name[0] || m->type[0] || m->compatible[0]) {
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, node->name);
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, node->type);
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp(m->compatible, cp,
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && !of_compat_cmp(m->compatible, cp,
                                                        strlen(m->compatible));
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && of_match_type_or_name(node, m))
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

Quoted 8 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
Linuxppc-dev mailing list Linuxppc-dev-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAP=VYLr7hqnzW2HLS4GCMFeghCgPmrQZHYst+AUfZc_WNT-Wog-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#9 lore raw
Quoted 91 lines · Paul Gortmaker
Quoted 7 lines · Rob Herring
Quoted 6 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

Quoted 7 lines
Quoted 4 lines

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548. It fails with:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will compare each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered from specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]
Quoted 8 lines

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

It looks like the new matching function doesn't check the validity of the entire match (i.e. everything specified must match the node) before scoring it.

The ethernet driver has this match (among others):

        {
                .type = "network",
                .compatible = "gianfar",
        },

...while the mdio driver has this match (among others):

        {
                .type = "mdio",
                .compatible = "gianfar", 
                .data = &(struct fsl_pq_mdio_data) {
                        .mii_offset = offsetof(struct fsl_pq_mdio, mii),
                        .get_tbipa = get_gfar_tbipa,
                },
        },

(Yes, it's an awful device tree binding.)

It seems that the ethernet device is being bound to the mdio driver due to the compatible match, even though type differs.

You could also end up with a .type and/or .name based match, despite .compatible being present an a mismatch.

-Scott

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to a message not in the archive
Quoted 11 lines · Paul Gortmaker
Quoted 10 lines · Rob Herring
Quoted 9 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based on a patch from Sebastian Hesselbarth.
http://patchwork.ozlabs.org/patch/319434/

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I did some code refactoring and also fixed a bug in the original patch.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548. It fails with:

I think I've got it fixed now with the latest series. Please try the devicetree/merge branch on git://git.secretlab.ca/git/linux

g.

Quoted 79 lines

-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will compare each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered from specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Quoted 126 lines

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

Quoted 119 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

Rob

Quoted 97 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -19
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, node->name);
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, node->type);
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                                           const struct device_node *node)
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current compatible string */
                while (m->name[0] || m->type[0] || m->compatible[0]) {
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, node->name);
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, node->type);
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp(m->compatible, cp,
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && !of_compat_cmp(m->compatible, cp,
                                                        strlen(m->compatible));
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && of_match_type_or_name(node, m))
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
Linuxppc-dev mailing list Linuxppc-dev-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20140219204134.E4A2DC4088D-WNowdnHR2B42iJbIjFUEsiwD8/[email protected]

#12 lore raw
Quoted 14 lines · Grant Likely
Quoted 13 lines · Paul Gortmaker
Quoted 12 lines · Rob Herring
Quoted 10 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548. It fails with:

I think I've got it fixed now with the latest series. Please try the devicetree/merge branch on git://git.secretlab.ca/git/linux

That seems to work.

libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17

...

root@sbc8548:~# cat /proc/version 
Linux version 3.14.0-rc3-00024-g7119f42057c6 (paul@yow-lpgnfs-02) (gcc version 4.5.2 (GCC) ) #1 Wed Feb 19 16:08:17 EST 2014
root@sbc8548:~#

Paul.
--

Quoted 209 lines

g.

Quoted 205 lines

-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will compare each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered from specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

Quoted 119 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

Rob

Quoted 97 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -19
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, node->name);
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, node->type);
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                                           const struct device_node *node)
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current compatible string */
                while (m->name[0] || m->type[0] || m->compatible[0]) {
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, node->name);
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, node->type);
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp(m->compatible, cp,
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && !of_compat_cmp(m->compatible, cp,
                                                        strlen(m->compatible));
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && of_match_type_or_name(node, m))
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

A message that is not in the archive (sent off-list or not yet received): 530520B6.8050205@windriver .com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw
Quoted 18 lines · Paul Gortmaker
Quoted 17 lines · Grant Likely
Quoted 16 lines · Paul Gortmaker
Quoted 14 lines · Rob Herring
Quoted 10 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548. It fails with:

I think I've got it fixed now with the latest series. Please try the devicetree/merge branch on git://git.secretlab.ca/git/linux

That seems to work.

Great, thanks for the testing. Can I add a Tested-by line for you?

g.

Quoted 17 lines

libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17

Quoted 218 lines

...

root@sbc8548:~# cat /proc/version 
Linux version 3.14.0-rc3-00024-g7119f42057c6 (paul@yow-lpgnfs-02) (gcc version 4.5.2 (GCC) ) #1 Wed Feb 19 16:08:17 EST 2014
root@sbc8548:~#

Paul.
--

Quoted 209 lines

g.

Quoted 205 lines

-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will compare each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered from specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

Quoted 119 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

Rob

Quoted 97 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -19
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, node->name);
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, node->type);
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                                           const struct device_node *node)
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current compatible string */
                while (m->name[0] || m->type[0] || m->compatible[0]) {
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, node->name);
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, node->type);
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp(m->compatible, cp,
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && !of_compat_cmp(m->compatible, cp,
                                                        strlen(m->compatible));
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && of_match_type_or_name(node, m))
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
Linuxppc-dev mailing list Linuxppc-dev-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20140219224051.65BB7C4077A-WNowdnHR2B42iJbIjFUEsiwD8/[email protected]

#17 lore raw
Quoted 22 lines · Grant Likely
Quoted 21 lines · Paul Gortmaker
Quoted 20 lines · Grant Likely
Quoted 18 lines · Paul Gortmaker
Quoted 7 lines · Rob Herring
Quoted 6 lines · Kevin Hao

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

Quoted 7 lines
Quoted 4 lines

This is based 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.

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548. It fails with:

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I think I've got it fixed now with the latest series. Please try the devicetree/merge branch on git://git.secretlab.ca/git/linux

That seems to work.

Great, thanks for the testing. Can I add a Tested-by line for you?

Absolutely; sorry for not thinking to explicitly indicate that.

P.
--

Quoted 239 lines

g.

Quoted 235 lines

libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17

...

root@sbc8548:~# cat /proc/version 
Linux version 3.14.0-rc3-00024-g7119f42057c6 (paul@yow-lpgnfs-02) (gcc version 4.5.2 (GCC) ) #1 Wed Feb 19 16:08:17 EST 2014
root@sbc8548:~#

Paul.
--

Quoted 209 lines

g.

Quoted 205 lines

-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will compare each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered from specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

Quoted 119 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first for best compatible with name and type NULL, then search the table the old way. I realize it appears you are doing this, but it is not clear this is the intent of the code. I would like to see this written as a patch with commit 105353145eafb3ea919 reverted first and you add a new match function to call first and then fallback to the existing function.

Rob

Quoted 97 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/of/base.c +37 -19
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, node->name);
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, node->type);
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                                           const struct device_node *node)
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current compatible string */
                while (m->name[0] || m->type[0] || m->compatible[0]) {
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, node->name);
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, node->type);
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp(m->compatible, cp,
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && !of_compat_cmp(m->compatible, cp,
                                                        strlen(m->compatible));
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && of_match_type_or_name(node, m))
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

Tested-by Stephen Chivers
#18 lore raw
In reply to Grant Likely

Grant Likely <[email protected]> wrote on 02/20/2014 07:41:34 AM:

Quoted 9 lines

From: Grant Likely <[email protected]>
To: Paul Gortmaker <[email protected]>, Rob Herring <[email protected]>
Cc: Kevin Hao <[email protected]>, "[email protected]" <[email protected]>, Arnd Bergmann <[email protected]>, Chris Proctor <[email protected]>, Stephen N Chivers <[email protected]>, Rob Herring <[email protected]>, Scott Wood <[email protected]>, linuxppc-dev <linuxppc- [email protected]>, Sebastian Hesselbarth

<[email protected]>

Quoted 8 lines

Date: 02/20/2014 07:41 AM
Subject: Re: [PATCH] of: give priority to the compatible match in __of_match_node()
Sent by: Grant Likely <[email protected]>

Quoted 1 line · Paul Gortmaker

On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <[email protected]>

Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

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 match, we then consider the candidate which doesn't have compatible entry but do match the type or name with the device node.

This is based 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.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

I'm inclined to just revert this once again and avoid possibly breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to

boot

Quoted 4 lines
Quoted 1 line

on my sbc8548. It fails with:

I think I've got it fixed now with the latest series. Please try the devicetree/merge branch on git://git.secretlab.ca/git/linux

I have tested this with the following platforms: MVME5100, MVME4100, SAM440EP and MPC8349MITXGP. All boot and reach the login state on the serial console.

The MVME4100 is a MPC8548 platform like the SBC8548 and suffered from the same PHY address is too large problem when used with todays linux-next.

Quoted 48 lines

g.

Quoted 45 lines

-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520 PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256 fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4 fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256 fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------

Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4

Author: Kevin Hao <[email protected]>
Date:   Tue Feb 18 15:57:30 2014 +0800

of: reimplement the matching method for __of_match_node()

In the current implementation of __of_match_node(), it will

compare

Quoted 5 lines
Quoted 5 lines

each given match entry against all the node's compatible strings with of_device_is_compatible().

To achieve multiple compatible strings per node with ordering from specific to generic, this requires given matches to be ordered

from

Quoted 37 lines
Quoted 37 lines

specific to generic. For most of the drivers this is not true and also an alphabetical ordering is more sane there.

Therefore, we define a following priority order for the match, and then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name

This is based on some pseudo-codes provided by Grant Likely.

[grant.likely: Changed multiplier to 4 which makes more sense]

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M drivers

As a double check, I checked out the head of linux-next, and did a revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

Quoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

However, I think I would like to see this structured differently. We basically have 2 ways of matching: the existing pre-3.14 way and the desired match on best compatible only. All new bindings should match with the new way and the old way needs to be kept for compatibility. So lets structure the code that way. Search the match table first

for

Quoted 1 line
Quoted 1 line
Quoted 1 line

best compatible with name and type NULL, then search the table the

old

Quoted 1 line
Quoted 1 line
Quoted 1 line

way. I realize it appears you are doing this, but it is not clear

this

Quoted 1 line
Quoted 1 line
Quoted 1 line

is the intent of the code. I would like to see this written as a

patch

Quoted 1 line
Quoted 1 line
Quoted 1 line

with commit 105353145eafb3ea919 reverted first and you add a new

match

Quoted 20 lines
Quoted 9 lines
Quoted 9 lines

function to call first and then fallback to the existing function.

Rob

Quoted 5 lines
Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/of/base.c | 55 ++++++++++++++++++++++++++++++++++++
+------------------
> >>  1 file changed, 37 insertions(+), 18 deletions(-)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/of/base.c +0 -0
index ff85450d5683..9d655df458bd 100644
@@ -730,32 +730,45 @@ out:
 }
 EXPORT_SYMBOL(of_find_node_with_property);
 
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/of/base.c out: · line 739

Quoted 7 lines
drivers/of/base.c +7 -0
+static int of_match_type_or_name(const struct device_node *node,
+                               const struct of_device_id *m)
+{
+       int match = 1;
+
+       if (m->name[0])
+               match &= node->name && !strcmp(m->name, 

node->name);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/of/base.c out: · line 742

Quoted 3 lines
drivers/of/base.c +3 -0
+
+       if (m->type[0])
+               match &= node->type && !strcmp(m->type, 

node->type);

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines

drivers/of/base.c out: · line 748

Quoted 6 lines
drivers/of/base.c +4 -0
+
+       return match;
+}
+
 static
 const struct of_device_id *__of_match_node(const struct 

of_device_id *matches,

Quoted 1 line
Quoted 1 line

drivers/of/base.c out: · line 749

Quoted 1 line
drivers/of/base.c +0 -0
                                           const struct 

device_node *node)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/of/base.c +2 -0
 {
        const char *cp;
        int cplen, l;
+       const struct of_device_id *m;
+       int match;
 
        if (!matches)
                return NULL;
 
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

drivers/of/base.c out: · line 763

Quoted 7 lines
drivers/of/base.c +2 -2
        cp = __of_get_property(node, "compatible", &cplen);
-       do {
-               const struct of_device_id *m = matches;
+       while (cp && (cplen > 0)) {
+               m = matches;
 
                /* Check against matches with current 

compatible string */

Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/of/base.c +0 -0
                while (m->name[0] || m->type[0] || 

m->compatible[0]) {

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/of/base.c out: · line 752

Quoted 4 lines
drivers/of/base.c +0 -4
-                       int match = 1;
-                       if (m->name[0])
-                               match &= node->name
-                                       && !strcmp(m->name, 

node->name);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/of/base.c out: · line 755

Quoted 3 lines
drivers/of/base.c +0 -3
-                       if (m->type[0])
-                               match &= node->type
-                                       && !strcmp(m->type, 

node->type);

Quoted 11 lines
Quoted 3 lines
Quoted 3 lines

drivers/of/base.c out: · line 758

Quoted 3 lines
drivers/of/base.c +0 -3
-                       if (m->compatible[0])
-                               match &= cp
-                                       && !of_compat_cmp

(m->compatible, cp,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/of/base.c +7 -0
+                       if (!m->compatible[0]) {
+                               m++;
+                               continue;
+                       }
+
+                       match = of_match_type_or_name(node, m);
+                       match &= cp && 

!of_compat_cmp(m->compatible, cp,

Quoted 24 lines
Quoted 1 line
Quoted 1 line

drivers/of/base.c out: · line 772

Quoted 1 line
drivers/of/base.c +0 -0
                                                        strlen

(m->compatible));

Quoted 3 lines
Quoted 3 lines

drivers/of/base.c const struct of_device_id

Quoted 3 lines
drivers/of/base.c +0 -0
                        if (match)
                                return m;
@@ -763,12 +776,18 @@ const struct of_device_id 

*__of_match_node(const struct of_device_id *matches,

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/of/base.c +9 -6
                }
 
                /* Get node's next compatible string */
-               if (cp) {
-                       l = strlen(cp) + 1;
-                       cp += l;
-                       cplen -= l;
-               }
-       } while (cp && (cplen > 0));
+               l = strlen(cp) + 1;
+               cp += l;
+               cplen -= l;
+       }
+
+       m = matches;
+       /* Check against matches without compatible string */
+       while (m->name[0] || m->type[0] || m->compatible[0]) {
+               if (!m->compatible[0] && 

of_match_type_or_name(node, m))

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/of/base.c +3 -1
+                       return m;
+               m++;
+       }
 
        return NULL;
 }
--

1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe

devicetree" in

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev