Re: [PATCH] DT: Use helper function to read u32 values
From: Manjunatha GK <hidden>
Date: 2011-07-01 17:44:01
Hi Grant, On 1 July 2011 20:07, Grant Likely [off-list ref] wrote:
On Fri, Jul 1, 2011 at 7:55 AM, Manjunatha GK [off-list ref] wrote:quoted
Use helper function of_property_read_u32() in place of of_get_property and be32_to_cpup() api's for code optimization. Compile tested the changes. Signed-off-by: G, Manjunath Kondaiah <redacted> --- drivers/of/irq.c | 37 ++++++++++++++++++++++--------------- drivers/of/of_i2c.c | 8 +++----- drivers/of/of_mdio.c | 16 ++++++---------- 3 files changed, 31 insertions(+), 30 deletions(-)diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9f689f1..13c02e2 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c@@ -59,20 +59,20 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); struct device_node *of_irq_find_parent(struct device_node *child) { struct device_node *p; - const __be32 *parp; + u32 *parp = NULL; if (!of_node_get(child)) return NULL; do { - parp = of_get_property(child, "interrupt-parent", NULL); + of_property_read_u32(child, "interrupt-parent", parp); if (parp == NULL) p = of_get_parent(child);Hi Manjunatha. This won't work. You must pass a valid pointer. It needs to be done this way; u32 parp; if (of_property_read_u32(child, "interrupt-parent", &parp) == 0) { ... } else { ... }
Thanks for the quick catch. I will fix it. -Manjunath