From 88af7f58c6f1fa28d617392c791f11317bcb590d Mon Sep 17 00:00:00 2001 From: Benoit Cousson Date: Mon, 5 Dec 2011 15:23:54 +0100 Subject: of/base: Take NULL string into account for property with multiple strings The current implementation just ignore any NULL string inserted in a multiple strings property. In some cases we can have a property with a fix number of strings but not necessarily used, like for example in a list of valid pinmux modes. prop = "uart_rx", "uart_tx", "", "", "safe_mode"; Do no skip NULL string and take them into account in of_property_read_string_index and of_property_count_strings. Reported-by: Tony Lindgren Signed-off-by: Benoit Cousson Cc: Grant Likely Signed-off-by: Rob Herring --- drivers/of/base.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'drivers/of') diff --git a/drivers/of/base.c b/drivers/of/base.c index 9b6588e..b707243 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -752,7 +752,7 @@ int of_property_read_string_index(struct device_node *np, const char *propname, for (i = 0; total < prop->length; total += l, p += l) { l = strlen(p) + 1; - if ((*p != 0) && (i++ == index)) { + if (i++ == index) { *output = p; return 0; } @@ -790,11 +790,9 @@ int of_property_count_strings(struct device_node *np, const char *propname) p = prop->value; - for (i = 0; total < prop->length; total += l, p += l) { + for (i = 0; total < prop->length; total += l, p += l, i++) l = strlen(p) + 1; - if (*p != 0) - i++; - } + return i; } EXPORT_SYMBOL_GPL(of_property_count_strings); -- cgit v1.1 From 7b482c8360d368fd495685a2c69ca4f1e7b29764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 20 Dec 2011 22:56:45 +0100 Subject: ARM/of: allow *machine_desc.dt_compat to be const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows dt_compat to point to a constant list of compatible strings. Signed-off-by: Uwe Kleine-König Signed-off-by: Rob Herring --- drivers/of/fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/of') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fd85fa2..7dc8e6d 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -107,7 +107,7 @@ int of_fdt_is_compatible(struct boot_param_header *blob, * of_fdt_match - Return true if node matches a list of compatible values */ int of_fdt_match(struct boot_param_header *blob, unsigned long node, - const char **compat) + const char *const *compat) { unsigned int tmp, score = 0; @@ -541,7 +541,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) /** * of_flat_dt_match - Return true if node matches a list of compatible values */ -int __init of_flat_dt_match(unsigned long node, const char **compat) +int __init of_flat_dt_match(unsigned long node, const char *const *compat) { return of_fdt_match(initial_boot_params, node, compat); } -- cgit v1.1 From 8af0da93da7c40526959ab5291964581c678d3e7 Mon Sep 17 00:00:00 2001 From: Dong Aisheng Date: Thu, 22 Dec 2011 20:19:24 +0800 Subject: dt: reform for_each_property to for_each_property_of_node Make this macro easier to use(do not need to pass properties, a node is enough), also change to a more sensible name as for_each_child_of_node. Signed-off-by: Dong Aisheng Cc: Grant Likely Signed-off-by: Rob Herring --- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/of') diff --git a/drivers/of/base.c b/drivers/of/base.c index b707243..0181eeb 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1157,7 +1157,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) if (!of_aliases) return; - for_each_property(pp, of_aliases->properties) { + for_each_property_of_node(of_aliases, pp) { const char *start = pp->name; const char *end = start + strlen(start); struct device_node *np; -- cgit v1.1 From 75c71848f22e6381f48614da23df2a43e374b498 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 27 Dec 2011 22:58:40 +0100 Subject: of/pdt: fix section mismatch warning Fix the following section mismatch warning - seen when building sparc32: WARNING: vmlinux.o(.text+0x1ff9c0): Section mismatch in reference from the function kernel_tree_alloc() to the function .init.text:prom_early_alloc() The function kernel_tree_alloc() references the function __init prom_early_alloc(). This is often because kernel_tree_alloc lacks a __init annotation or the annotation of prom_early_alloc is wrong. prom_early_alloc() is annotated __init, and users of kernel_tree_alloc() is also annotated __init. So simply match the annoation of these to fix the warning. Signed-off-by: Sam Ravnborg Cc: Grant Likely Acked-by: David S. Miller Signed-off-by: Rob Herring --- drivers/of/pdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/of') diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c index bc5b399..07cc1d6 100644 --- a/drivers/of/pdt.c +++ b/drivers/of/pdt.c @@ -229,7 +229,7 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent, return ret; } -static void *kernel_tree_alloc(u64 size, u64 align) +static void * __init kernel_tree_alloc(u64 size, u64 align) { return prom_early_alloc(size); } -- cgit v1.1 From c89810acbcf48c7004e912b2b4b862480b2d00e1 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 2 Jan 2012 14:19:03 -0200 Subject: ARM: prom.h: Fix build error by removing unneeded header file Fix the following build error: CC [M] fs/udf/balloc.o In file included from /home/fabio/next/linux-next/arch/arm/include/asm/prom.h:16, from include/linux/of.h:140, from include/asm-generic/gpio.h:7, from arch/arm/plat-mxc/include/mach/irqs.h:14, from /home/fabio/next/linux-next/arch/arm/include/asm/irq.h:4, from /home/fabio/next/linux-next/arch/arm/include/asm/hardirq.h:6, from include/linux/hardirq.h:7, from include/linux/highmem.h:8, from include/linux/pagemap.h:10, from include/linux/buffer_head.h:13, from fs/udf/udfdecl.h:11, from fs/udf/balloc.c:22: /home/fabio/next/linux-next/arch/arm/include/asm/setup.h:146: error: redefinition of 'struct tag' Signed-off-by: Fabio Estevam [grant.likely: fix build failure on drivers/of/fdt.c] Signed-off-by: Grant Likely --- drivers/of/fdt.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/of') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 7dc8e6d..91a375f 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -18,6 +18,7 @@ #include #include +#include /* for COMMAND_LINE_SIZE */ #ifdef CONFIG_PPC #include #endif /* CONFIG_PPC */ -- cgit v1.1