From patchwork Wed Feb 23 07:11:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 583561 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1N7DIEM015753 for ; Wed, 23 Feb 2011 07:13:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175Ab1BWHNJ (ORCPT ); Wed, 23 Feb 2011 02:13:09 -0500 Received: from utopia.booyaka.com ([72.9.107.138]:58763 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752253Ab1BWHNI (ORCPT ); Wed, 23 Feb 2011 02:13:08 -0500 Received: (qmail 12707 invoked by uid 1019); 23 Feb 2011 07:13:07 -0000 MBOX-Line: From nobody Wed Feb 23 00:11:50 2011 Subject: [PATCH 4/8] OMAP2+: hwmod: find MPU initiator hwmod during in _register() To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Paul Walmsley Cc: Kevin Hilman , =?utf-8?q?Beno=C3=AEt?= Cousson Date: Wed, 23 Feb 2011 00:11:50 -0700 Message-ID: <20110223071146.5874.15334.stgit@twilight.localdomain> In-Reply-To: <20110223070455.5874.51326.stgit@twilight.localdomain> References: <20110223070455.5874.51326.stgit@twilight.localdomain> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Feb 2011 07:13:19 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 9e89a58..41f548e 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1455,7 +1455,7 @@ static int _setup(struct omap_hwmod *oh, void *data) */ static int __init _register(struct omap_hwmod *oh) { - int ret, ms_id; + int ms_id; if (!oh || !oh->name || !oh->class || !oh->class->name || (oh->_state != _HWMOD_STATE_UNKNOWN)) @@ -1478,9 +1478,14 @@ static int __init _register(struct omap_hwmod *oh) oh->_state = _HWMOD_STATE_REGISTERED; - ret = 0; + /* + * XXX Rather than doing a strcmp(), this should test a flag + * set in the hwmod data, inserted by the autogenerator code. + */ + if (!strcmp(oh->name, MPU_INITIATOR_NAME)) + mpu_oh = oh; - return ret; + return 0; } @@ -1644,22 +1649,24 @@ static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) * * Must be called after omap2_clk_init(). Resolves the struct clk names * to struct clk pointers for each registered omap_hwmod. Also calls - * _setup() on each hwmod. Returns 0. + * _setup() on each hwmod. Returns 0 upon success or -EINVAL upon error. */ static int __init omap_hwmod_late_init(void) { int r; + if (!mpu_oh) { + pr_err("omap_hwmod: %s: MPU initiator hwmod %s not yet registered\n", + __func__, MPU_INITIATOR_NAME); + return -EINVAL; + } + r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL); /* XXX check return value */ r = omap_hwmod_for_each(_init_clocks, NULL); WARN(r, "omap_hwmod: omap_hwmod_late_init(): _init_clocks failed\n"); - mpu_oh = omap_hwmod_lookup(MPU_INITIATOR_NAME); - WARN(!mpu_oh, "omap_hwmod: could not find MPU initiator hwmod %s\n", - MPU_INITIATOR_NAME); - omap_hwmod_for_each(_setup, NULL); return 0;