From patchwork Tue Jul 13 09:42:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andres Salomon X-Patchwork-Id: 58573 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 640ABB70BB for ; Mon, 12 Jul 2010 16:21:00 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751742Ab0GLGU6 (ORCPT ); Mon, 12 Jul 2010 02:20:58 -0400 Received: from LUNGE.MIT.EDU ([18.54.1.69]:55001 "EHLO lunge.queued.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326Ab0GLGU6 (ORCPT ); Mon, 12 Jul 2010 02:20:58 -0400 Received: from debxo (c-71-237-163-83.hsd1.or.comcast.net [71.237.163.83]) by lunge.queued.net (Postfix) with ESMTPSA id A4A98398053; Mon, 12 Jul 2010 02:20:53 -0400 (EDT) Date: Tue, 13 Jul 2010 09:42:26 +0000 From: Andres Salomon To: Grant Likely Cc: devicetree-discuss@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net Subject: [PATCH] sparc: move is_root_node from private header to of.h Message-ID: <20100713094226.33b421dd@debxo> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.6; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Make is_root_node available for all archs to use, as it's not PROM-specific. Also rename it to of_is_root_node, and a few other minor changes for style/consistency. Signed-off-by: Andres Salomon Acked-by: David S. Miller --- arch/sparc/kernel/prom.h | 8 -------- arch/sparc/kernel/prom_64.c | 6 +++--- arch/sparc/kernel/prom_common.c | 2 +- include/linux/of.h | 8 ++++++++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index a8591ef..eeb04a7 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -9,14 +9,6 @@ extern void irq_trans_init(struct device_node *dp); extern unsigned int prom_unique_id; -static inline int is_root_node(const struct device_node *dp) -{ - if (!dp) - return 0; - - return (dp->parent == NULL); -} - extern char *build_path_component(struct device_node *dp); extern void of_console_init(void); diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index fb06ac2..dd5e487 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf) return; regs = rprop->value; - if (!is_root_node(dp->parent)) { + if (!of_is_root_node(dp->parent)) { sprintf(tmp_buf, "%s@%x,%x", dp->name, (unsigned int) (regs->phys_addr >> 32UL), @@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf) return; regs = prop->value; - if (!is_root_node(dp->parent)) { + if (!of_is_root_node(dp->parent)) { sprintf(tmp_buf, "%s@%x,%x", dp->name, (unsigned int) (regs->phys_addr >> 32UL), diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 57ac9e2..40123a6 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -244,7 +244,7 @@ char * __init build_full_name(struct device_node *dp) n = prom_early_alloc(len); strcpy(n, dp->parent->full_name); - if (!is_root_node(dp->parent)) { + if (!of_is_root_node(dp->parent)) { strcpy(n + plen, "/"); plen++; } diff --git a/include/linux/of.h b/include/linux/of.h index a367e19..b38cdf7 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -97,6 +97,14 @@ extern struct device_node *of_node_get(struct device_node *node); extern void of_node_put(struct device_node *node); #endif +static inline bool of_is_root_node(const struct device_node *node) +{ + if (!node) + return false; + + return (node->parent == NULL); +} + /* * OF address retreival & translation */