All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
@ 2021-05-21  7:30 Axel Lin
  2021-05-21 18:26 ` Cristian Marussi
  2021-05-21 19:37 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2021-05-21  7:30 UTC (permalink / raw)
  To: Mark Brown; +Cc: Cristian Marussi, Liam Girdwood, linux-kernel, Axel Lin

For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1.

Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/scmi-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
index bbadf72b94e8..1f02f60ad136 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -173,7 +173,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg,
 		sreg->desc.uV_step =
 			vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP];
 		sreg->desc.linear_min_sel = 0;
-		sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step;
+		sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1;
 		sreg->desc.ops = &scmi_reg_linear_ops;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
  2021-05-21  7:30 [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting Axel Lin
@ 2021-05-21 18:26 ` Cristian Marussi
  2021-05-21 19:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Cristian Marussi @ 2021-05-21 18:26 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Liam Girdwood, linux-kernel

Hi,

On Fri, May 21, 2021 at 03:30:20PM +0800, Axel Lin wrote:
> For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1.
> 
> Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---

Right. Good catch.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian

>  drivers/regulator/scmi-regulator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
> index bbadf72b94e8..1f02f60ad136 100644
> --- a/drivers/regulator/scmi-regulator.c
> +++ b/drivers/regulator/scmi-regulator.c
> @@ -173,7 +173,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg,
>  		sreg->desc.uV_step =
>  			vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP];
>  		sreg->desc.linear_min_sel = 0;
> -		sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step;
> +		sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1;
>  		sreg->desc.ops = &scmi_reg_linear_ops;
>  	}
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
  2021-05-21  7:30 [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting Axel Lin
  2021-05-21 18:26 ` Cristian Marussi
@ 2021-05-21 19:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-05-21 19:37 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Liam Girdwood, linux-kernel, Cristian Marussi

On Fri, 21 May 2021 15:30:20 +0800, Axel Lin wrote:
> For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
      commit: 36cb555fae0875d5416e8514a84a427bec6e4cda

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-21 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  7:30 [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting Axel Lin
2021-05-21 18:26 ` Cristian Marussi
2021-05-21 19:37 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.