From patchwork Mon Apr 27 16:26:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Carmody X-Patchwork-Id: 20187 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3RGQRk4003507 for ; Mon, 27 Apr 2009 16:26:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754423AbZD0QZz (ORCPT ); Mon, 27 Apr 2009 12:25:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755553AbZD0QZz (ORCPT ); Mon, 27 Apr 2009 12:25:55 -0400 Received: from smtp.nokia.com ([192.100.122.230]:54415 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754423AbZD0QZy (ORCPT ); Mon, 27 Apr 2009 12:25:54 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n3RGPY99008383 for ; Mon, 27 Apr 2009 19:25:48 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Apr 2009 19:25:45 +0300 Received: from mgw-int02.ntc.nokia.com ([172.21.143.97]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Apr 2009 19:25:45 +0300 Received: from localhost.localdomain (esdhcp04266.research.nokia.com [172.21.42.66]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n3RGPhGX021911; Mon, 27 Apr 2009 19:25:44 +0300 From: Phil Carmody To: linux-omap@vger.kernel.org Cc: Phil Carmody Subject: [PATCH 1/2] OMAP3: PM: Don't do unnecessary searches in omap_sr_vdd*_autocomp_store Date: Mon, 27 Apr 2009 19:26:24 +0300 Message-Id: <9ba9fdeeec0cd47fdcff6b689d2196665ea8bcbf.1240849197.git.ext-phil.2.carmody@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1240849585-14828-1-git-send-email-ext-phil.2.carmody@nokia.com> References: <> <1240849585-14828-1-git-send-email-ext-phil.2.carmody@nokia.com> X-OriginalArrivalTime: 27 Apr 2009 16:25:45.0716 (UTC) FILETIME=[D12A4B40:01C9C754] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Phil Carmody When setting to 0, we don't need to do searches for the resource by its name. In the case where we do search, handle the error condition cleanly. Signed-off-by: Phil Carmody --- arch/arm/mach-omap2/smartreflex.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index ae5c336..ce7d436 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -744,7 +744,6 @@ static ssize_t omap_sr_vdd1_autocomp_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { - u32 current_vdd1opp_no; unsigned short value; if (sscanf(buf, "%hu", &value) != 1 || (value > 1)) { @@ -752,13 +751,14 @@ static ssize_t omap_sr_vdd1_autocomp_store(struct kobject *kobj, return -EINVAL; } - current_vdd1opp_no = omap_pm_vdd1_get_opp(); - - if (value == 0) + if (value == 0) { sr_stop_vddautocomap(SR1); - else + } else { + u32 current_vdd1opp_no = omap_pm_vdd1_get_opp(); + if (IS_ERR_VALUE(current_vdd1opp_no)) + return -ENODEV; sr_start_vddautocomap(SR1, current_vdd1opp_no); - + } return n; } @@ -782,7 +782,6 @@ static ssize_t omap_sr_vdd2_autocomp_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { - u32 current_vdd2opp_no; unsigned short value; if (sscanf(buf, "%hu", &value) != 1 || (value > 1)) { @@ -790,13 +789,14 @@ static ssize_t omap_sr_vdd2_autocomp_store(struct kobject *kobj, return -EINVAL; } - current_vdd2opp_no = omap_pm_vdd2_get_opp(); - - if (value == 0) + if (value == 0) { sr_stop_vddautocomap(SR2); - else + } else { + u32 current_vdd2opp_no = omap_pm_vdd2_get_opp(); + if (IS_ERR_VALUE(current_vdd2opp_no)) + return -ENODEV; sr_start_vddautocomap(SR2, current_vdd2opp_no); - + } return n; }