From patchwork Thu Nov 5 07:45:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 37733 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 2FB8A1008C0 for ; Thu, 5 Nov 2009 18:45:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754621AbZKEHpq (ORCPT ); Thu, 5 Nov 2009 02:45:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754685AbZKEHpp (ORCPT ); Thu, 5 Nov 2009 02:45:45 -0500 Received: from mail-pw0-f42.google.com ([209.85.160.42]:59266 "EHLO mail-pw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754621AbZKEHpp (ORCPT ); Thu, 5 Nov 2009 02:45:45 -0500 Received: by pwj9 with SMTP id 9so3727900pwj.21 for ; Wed, 04 Nov 2009 23:45:50 -0800 (PST) Received: by 10.114.2.12 with SMTP id 12mr4406827wab.52.1257407150630; Wed, 04 Nov 2009 23:45:50 -0800 (PST) Received: from angua (S01060002b3d79728.cg.shawcable.net [68.146.87.181]) by mx.google.com with ESMTPS id 21sm1065754pzk.7.2009.11.04.23.45.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Nov 2009 23:45:49 -0800 (PST) Received: from [127.0.1.1] (unknown [IPv6:::1]) by angua (Postfix) with ESMTP id 69BEE11ED0; Thu, 5 Nov 2009 00:45:48 -0700 (MST) From: Grant Likely Subject: [PATCH 03/11] of/flattree: merge of_get_flat_dt_root To: linuxppc-dev@lists.ozlabs.org, devicetree-discuss@lists.ozlabs.org, benh@kernel.crashing.org, sfr@canb.auug.org.au, davem@davemloft.net, sparclinux@vger.kernel.org, monstr@monstr.eu, microblaze-uclinux@itee.uq.edu.au Date: Thu, 05 Nov 2009 00:45:48 -0700 Message-ID: <20091105074540.10460.75479.stgit@angua> In-Reply-To: <20091105073728.10460.6061.stgit@angua> References: <20091105073728.10460.6061.stgit@angua> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Merge common code between PowerPC and MicroBlaze Signed-off-by: Grant Likely --- arch/microblaze/kernel/prom.c | 12 ------------ arch/powerpc/kernel/prom.c | 12 ------------ drivers/of/fdt.c | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 24 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index 0db8ee6..7eb6f8b 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c @@ -50,18 +50,6 @@ typedef u32 cell_t; /* export that to outside world */ struct device_node *of_chosen; -unsigned long __init of_get_flat_dt_root(void) -{ - unsigned long p = ((unsigned long)initial_boot_params) + - initial_boot_params->off_dt_struct; - - while (*((u32 *)p) == OF_DT_NOP) - p += 4; - BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE); - p += 4; - return _ALIGN(p + strlen((char *)p) + 1, 4); -} - /** * This function can be used within scan_flattened_dt callback to get * access to properties diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 14a07b9..b5d5f85 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -80,18 +80,6 @@ extern rwlock_t devtree_lock; /* temporary while merging */ /* export that to outside world */ struct device_node *of_chosen; -unsigned long __init of_get_flat_dt_root(void) -{ - unsigned long p = ((unsigned long)initial_boot_params) + - initial_boot_params->off_dt_struct; - - while(*((u32 *)p) == OF_DT_NOP) - p += 4; - BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE); - p += 4; - return _ALIGN(p + strlen((char *)p) + 1, 4); -} - /** * This function can be used within scan_flattened_dt callback to get * access to properties diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 7c3c13c..a6e869e 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -84,3 +84,19 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, return rc; } + +/** + * of_get_flat_dt_root - find the root node in the flat blob + */ +unsigned long __init of_get_flat_dt_root(void) +{ + unsigned long p = ((unsigned long)initial_boot_params) + + initial_boot_params->off_dt_struct; + + while (*((u32 *)p) == OF_DT_NOP) + p += 4; + BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE); + p += 4; + return _ALIGN(p + strlen((char *)p) + 1, 4); +} +