From patchwork Thu Mar 18 00:09:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 47976 X-Patchwork-Delegate: grant.likely@secretlab.ca Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id CBAD1B7F75 for ; Thu, 18 Mar 2010 11:09:40 +1100 (EST) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DF226B7D17; Thu, 18 Mar 2010 11:09:28 +1100 (EST) Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id o2I092wk014303; Wed, 17 Mar 2010 19:09:15 -0500 Subject: [PATCH] powerpc/of: Fix comparison of "compatible" properties From: Benjamin Herrenschmidt To: linuxppc-dev Date: Thu, 18 Mar 2010 11:09:01 +1100 Message-ID: <1268870941.2335.214.camel@pasglop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Cc: microblaze-uclinux@itee.uq.edu.au, devicetree-discuss@lists.ozlabs.org, David Miller X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Commit 7c7b60cb87547b1664a4385c187f029bf514a737 "of: put default string compare and #a/s-cell values into common header" Breaks various things on powerpc due to using strncasecmp instead of strcasecmp for comparing against "compatible" strings. This causes things like the 4xx PCI code to fail miserably due to the partial matches in code like this: for_each_compatible_node(np, NULL, "ibm,plb-pcix") ppc4xx_probe_pcix_bridge(np); for_each_compatible_node(np, NULL, "ibm,plb-pci") ppc4xx_probe_pci_bridge(np); This reverts us to use strcasecmp. I do wonder why microblase and sparc want the partial matches though. For sparc it could be historical, but microblaze might want to change. It's not quite right to do partial name match. Entries in a compatible list are meant to be matched whole. If a device is compatible with both "foo" and "foo1", then the device should have both strings in its "compatible" property. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/include/asm/prom.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index ddd408a..47ce796 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h @@ -23,6 +23,14 @@ #include #include +/* We do -not- want the generic "strncasecmp" here for of_compat_cmp. + * We have cases where we could otherwise mismatch "pcix" and "pci" + * and similar. + */ +#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2)) +#define of_prop_cmp(s1, s2) strcmp((s1), (s2)) +#define of_node_cmp(s1, s2) strcasecmp((s1), (s2)) + #define HAVE_ARCH_DEVTREE_FIXUPS #ifdef CONFIG_PPC32