From patchwork Wed Feb 16 12:11:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 566781 X-Patchwork-Delegate: paul@pwsan.com 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 p1GCBecn002276 for ; Wed, 16 Feb 2011 12:11:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932203Ab1BPMLi (ORCPT ); Wed, 16 Feb 2011 07:11:38 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:52138 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759033Ab1BPMLg (ORCPT ); Wed, 16 Feb 2011 07:11:36 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p1GCBSPV004647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Feb 2011 06:11:31 -0600 Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p1GCBQhS010880; Wed, 16 Feb 2011 17:41:26 +0530 (IST) Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by linfarm476.india.ti.com (8.12.11/8.12.11) with ESMTP id p1GCBQgE007178; Wed, 16 Feb 2011 17:41:26 +0530 Received: (from a0131687@localhost) by linfarm476.india.ti.com (8.12.11/8.12.11/Submit) id p1GCBQ9w007176; Wed, 16 Feb 2011 17:41:26 +0530 From: Rajendra Nayak To: linux-omap@vger.kernel.org Cc: paul@pwsan.com, b-cousson@ti.com, linux-arm-kernel@lists.infradead.org, Rajendra Nayak Subject: [PATCH 3/3] OMAP2+: hwmod: Do not break iterator fn's if one fails Date: Wed, 16 Feb 2011 17:41:25 +0530 Message-Id: <1297858285-7056-4-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.5.6.6 In-Reply-To: <1297858285-7056-3-git-send-email-rnayak@ti.com> References: <1297858285-7056-1-git-send-email-rnayak@ti.com> <1297858285-7056-2-git-send-email-rnayak@ti.com> <1297858285-7056-3-git-send-email-rnayak@ti.com> 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, 16 Feb 2011 12:11:40 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 960461f..3cab82e 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1568,25 +1568,21 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name) * * Call @fn for each registered omap_hwmod, passing @data to each * function. @fn must return 0 for success or any other value for - * failure. If @fn returns non-zero, the iteration across omap_hwmods - * will stop and the non-zero return value will be passed to the - * caller of omap_hwmod_for_each(). @fn is called with + * failure. Return value of all callback functions is OR'd and the + * value is passed back to the caller. @fn is called with * omap_hwmod_for_each() held. */ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), void *data) { struct omap_hwmod *temp_oh; - int ret; + int ret = 0; if (!fn) return -EINVAL; - list_for_each_entry(temp_oh, &omap_hwmod_list, node) { - ret = (*fn)(temp_oh, data); - if (ret) - break; - } + list_for_each_entry(temp_oh, &omap_hwmod_list, node) + ret |= (*fn)(temp_oh, data); return ret; } @@ -2127,8 +2123,7 @@ int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name) * @user: arbitrary context data to pass to the callback function * * For each omap_hwmod of class @classname, call @fn. - * If the callback function returns something other than - * zero, the iterator is terminated, and the callback function's return + * Return value of all callback functions is OR'd and the * value is passed back to the caller. Returns 0 upon success, -EINVAL * if @classname or @fn are NULL, or passes back the error code from @fn. */ @@ -2150,14 +2145,12 @@ int omap_hwmod_for_each_by_class(const char *classname, if (!strcmp(temp_oh->class->name, classname)) { pr_debug("omap_hwmod: %s: %s: calling callback fn\n", __func__, temp_oh->name); - ret = (*fn)(temp_oh, user); - if (ret) - break; + ret |= (*fn)(temp_oh, user); } } if (ret) - pr_debug("omap_hwmod: %s: iterator terminated early: %d\n", + pr_debug("omap_hwmod: %s: one or more callback fn failed: %d\n", __func__, ret); return ret;