Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751325AbcDOKSY (ORCPT ); Fri, 15 Apr 2016 06:18:24 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48195 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802AbcDOKSX (ORCPT ); Fri, 15 Apr 2016 06:18:23 -0400 Message-ID: <5710BFE7.9060802@codeaurora.org> Date: Fri, 15 Apr 2016 15:48:15 +0530 From: Rajendra Nayak User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Stephen Boyd , Mark Brown CC: linux-arm@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Georgi Djakov , David Collins Subject: Re: [PATCH v2 2/2] regulator: qcom_spmi: Only use selector based regulator ops References: <1459389470-29365-1-git-send-email-stephen.boyd@linaro.org> <1459389470-29365-3-git-send-email-stephen.boyd@linaro.org> In-Reply-To: <1459389470-29365-3-git-send-email-stephen.boyd@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1789 Lines: 56 []... > static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg, > - int min_uV, int max_uV, u8 *range_sel, u8 *voltage_sel, > - unsigned *selector) > + int min_uV, int max_uV) > { > const struct spmi_voltage_range *range; > int uV = min_uV; > - int i; > + int i, selector; > > range = spmi_regulator_find_range(vreg); > if (!range) > @@ -638,8 +665,8 @@ static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg, > * Force uV to be an allowed set point by applying a ceiling function to > * the uV value. > */ > - *voltage_sel = DIV_ROUND_UP(uV - range->min_uV, range->step_uV); > - uV = *voltage_sel * range->step_uV + range->min_uV; > + uV = DIV_ROUND_UP(uV - range->min_uV, range->step_uV); > + uV = uV * range->step_uV + range->min_uV; > > if (uV > max_uV) { > /* > @@ -649,43 +676,49 @@ static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg, > goto different_range; > } > > - *selector = 0; > + selector = 0; > for (i = 0; i < vreg->set_points->count; i++) { > if (uV >= vreg->set_points->range[i].set_point_min_uV > && uV <= vreg->set_points->range[i].set_point_max_uV) { > - *selector += > + selector += > (uV - vreg->set_points->range[i].set_point_min_uV) > / vreg->set_points->range[i].step_uV; > break; > } > > - *selector += vreg->set_points->range[i].n_voltages; > + selector += vreg->set_points->range[i].n_voltages; > } > > - if (*selector >= vreg->set_points->n_voltages) > + if (selector >= vreg->set_points->n_voltages) > goto different_range; > > return 0; This should now return selector instead of 0 -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation