From patchwork Wed Aug 8 10:35:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Bedia X-Patchwork-Id: 1294391 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 688DF3FC23 for ; Wed, 8 Aug 2012 10:38:37 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sz3bz-0000m3-Gj; Wed, 08 Aug 2012 10:35:35 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sz3bv-0000lp-Os for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2012 10:35:32 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q78AZR5D022096; Wed, 8 Aug 2012 05:35:28 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q78AZPS9000457; Wed, 8 Aug 2012 16:05:26 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Wed, 8 Aug 2012 16:05:25 +0530 Received: from localhost.localdomain (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q78AZNiR026344; Wed, 8 Aug 2012 16:05:23 +0530 From: Vaibhav Bedia To: , Subject: [PATCH 1/1] ARM: OMAP2+: hwmod: Print an error message if no match exists for a hwmod class Date: Wed, 8 Aug 2012 16:05:17 +0530 Message-ID: <1344422117-20707-1-git-send-email-vaibhav.bedia@ti.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-omap@vger.kernel.org, Vaibhav Bedia , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If no match is found for a hwmod class, omap_hwmod_for_each_by_class() currently does not spit out any error messages. To make debugging issues related to non-existent hwmod classes simpler make this function print an error message in case no match is found for the supplied hwmod class. Signed-off-by: Vaibhav Bedia --- arch/arm/mach-omap2/omap_hwmod.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 6ca8e51..90e2306 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -3480,7 +3480,8 @@ int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name) * If the callback function returns something other than * zero, the iterator is terminated, and the callback function's return * 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. + * if @classname or @fn are NULL or no match is found for @classname, + * or passes back the error code from @fn. */ int omap_hwmod_for_each_by_class(const char *classname, int (*fn)(struct omap_hwmod *oh, @@ -3489,6 +3490,7 @@ int omap_hwmod_for_each_by_class(const char *classname, { struct omap_hwmod *temp_oh; int ret = 0; + bool found = false; if (!classname || !fn) return -EINVAL; @@ -3498,6 +3500,7 @@ int omap_hwmod_for_each_by_class(const char *classname, list_for_each_entry(temp_oh, &omap_hwmod_list, node) { if (!strcmp(temp_oh->class->name, classname)) { + found = true; pr_debug("omap_hwmod: %s: %s: calling callback fn\n", __func__, temp_oh->name); ret = (*fn)(temp_oh, user); @@ -3506,6 +3509,12 @@ int omap_hwmod_for_each_by_class(const char *classname, } } + if (!found) { + pr_err("omap_hwmod: %s: no match for class %s\n", + __func__, classname); + return -EINVAL; + } + if (ret) pr_debug("omap_hwmod: %s: iterator terminated early: %d\n", __func__, ret);