From patchwork Fri Mar 15 13:00:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 2276801 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 398033FC8A for ; Fri, 15 Mar 2013 13:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754691Ab3CONK0 (ORCPT ); Fri, 15 Mar 2013 09:10:26 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:42593 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754774Ab3CONKY (ORCPT ); Fri, 15 Mar 2013 09:10:24 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2FDAMSZ006641; Fri, 15 Mar 2013 08:10:22 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2FDAMjN010329; Fri, 15 Mar 2013 08:10:22 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Fri, 15 Mar 2013 08:10:22 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2FDAMdR000822; Fri, 15 Mar 2013 08:10:22 -0500 Received: from localhost (h64-13.vpn.ti.com [172.24.64.13]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r2FDAIV10086; Fri, 15 Mar 2013 08:10:18 -0500 (CDT) From: Eduardo Valentin To: CC: , , , , Eduardo Valentin Subject: [PATCH 25/50] staging: omap-thermal: rewrite omap_bandgap_mcelsius_to_adc on kernel coding style Date: Fri, 15 Mar 2013 09:00:13 -0400 Message-ID: <1363352438-15935-26-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.7.7.1.488.ge8e1c In-Reply-To: <1363352438-15935-1-git-send-email-eduardo.valentin@ti.com> References: <1363352438-15935-1-git-send-email-eduardo.valentin@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Follow Documentation/CodingStyle while doing omap_bandgap_mcelsius_to_adc Signed-off-by: Eduardo Valentin --- drivers/staging/omap-thermal/omap-bandgap.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index d5359e3..e49a115 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -270,14 +270,16 @@ int omap_bandgap_mcelsius_to_adc(struct omap_bandgap *bg_ptr, int i, long temp, { struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[i].ts_data; const int *conv_table = bg_ptr->conf->conv_table; - int high, low, mid; + int high, low, mid, ret = 0; low = 0; high = ts_data->adc_end_val - ts_data->adc_start_val; mid = (high + low) / 2; - if (temp < conv_table[low] || temp > conv_table[high]) - return -EINVAL; + if (temp < conv_table[low] || temp > conv_table[high]) { + ret = -ERANGE; + goto exit; + } while (low < high) { if (temp < conv_table[mid]) @@ -289,7 +291,8 @@ int omap_bandgap_mcelsius_to_adc(struct omap_bandgap *bg_ptr, int i, long temp, *adc = ts_data->adc_start_val + low; - return 0; +exit: + return ret; } /* Talert masks. Call it only if HAS(TALERT) is set */