[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5710BFE7.9060802@codeaurora.org>
Date: Fri, 15 Apr 2016 15:48:15 +0530
From: Rajendra Nayak <rnayak@...eaurora.org>
To: Stephen Boyd <stephen.boyd@...aro.org>,
Mark Brown <broonie@...nel.org>
CC: linux-arm@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
Georgi Djakov <georgi.djakov@...aro.org>,
David Collins <collinsd@...eaurora.org>
Subject: Re: [PATCH v2 2/2] regulator: qcom_spmi: Only use selector based
regulator ops
[]...
> 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
Powered by blists - more mailing lists