From patchwork Wed Feb 23 07:11:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 583531 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 p1N7DC3L015684 for ; Wed, 23 Feb 2011 07:13:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753268Ab1BWHNK (ORCPT ); Wed, 23 Feb 2011 02:13:10 -0500 Received: from utopia.booyaka.com ([72.9.107.138]:58767 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513Ab1BWHNI (ORCPT ); Wed, 23 Feb 2011 02:13:08 -0500 Received: (qmail 12715 invoked by uid 1019); 23 Feb 2011 07:13:07 -0000 MBOX-Line: From nobody Wed Feb 23 00:11:51 2011 Subject: [PATCH 5/8] OMAP2+: hwmod: allow multiple calls to omap_hwmod_init() 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:51 -0700 Message-ID: <20110223071150.5874.58996.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:15 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 41f548e..86eacaf 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -162,9 +162,6 @@ static LIST_HEAD(omap_hwmod_list); /* mpu_oh: used to add/remove MPU initiator from sleepdep list */ static struct omap_hwmod *mpu_oh; -/* inited: 0 if omap_hwmod_init() has not yet been called; 1 otherwise */ -static u8 inited; - /* Private functions */ @@ -1600,26 +1597,20 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), */ int __init omap_hwmod_init(struct omap_hwmod **ohs) { - struct omap_hwmod *oh; - int r; - - if (inited) - return -EINVAL; - - inited = 1; + int r, i; if (!ohs) return 0; - oh = *ohs; - while (oh) { - if (omap_chip_is(oh->omap_chip)) { - r = _register(oh); - WARN(r, "omap_hwmod: %s: _register returned " - "%d\n", oh->name, r); - } - oh = *++ohs; - } + i = 0; + do { + if (!omap_chip_is(ohs[i]->omap_chip)) + continue; + + r = _register(ohs[i]); + WARN(r, "omap_hwmod: %s: _register returned %d\n", ohs[i]->name, + r); + } while (ohs[++i]); return 0; }