From: Rajendra Nayak <rnayak@codeaurora.org>
To: Stephen Boyd <stephen.boyd@linaro.org>, Mark Brown <broonie@kernel.org>
Cc: linux-arm@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Georgi Djakov <georgi.djakov@linaro.org>,
David Collins <collinsd@codeaurora.org>
Subject: Re: [PATCH v2 2/2] regulator: qcom_spmi: Only use selector based regulator ops
Date: Fri, 15 Apr 2016 15:48:15 +0530 [thread overview]
Message-ID: <5710BFE7.9060802@codeaurora.org> (raw)
In-Reply-To: <1459389470-29365-3-git-send-email-stephen.boyd@linaro.org>
[]...
> 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
next prev parent reply other threads:[~2016-04-15 10:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 1:57 [PATCH v2 0/2] Proper slewing delays for qcom spmi regulators Stephen Boyd
2016-03-31 1:57 ` [PATCH v2 1/2] regulator: qcom_spmi: Add slewing delays for all SMPS types Stephen Boyd
2016-03-31 1:57 ` [PATCH v2 2/2] regulator: qcom_spmi: Only use selector based regulator ops Stephen Boyd
2016-04-15 10:18 ` Rajendra Nayak [this message]
2016-04-15 17:44 ` [PATCH] regulator: qcom_spmi: Always return a selector when asked Stephen Boyd
2016-04-18 13:10 ` Applied "regulator: qcom_spmi: Always return a selector when asked" to the regulator tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5710BFE7.9060802@codeaurora.org \
--to=rnayak@codeaurora.org \
--cc=broonie@kernel.org \
--cc=collinsd@codeaurora.org \
--cc=georgi.djakov@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-arm@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stephen.boyd@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).