Re: [PATCH 2/2] regulator: core: Check that the selector frommap_voltage() is valid

From: Axel Lin
Date: Tue Jun 26 2012 - 08:41:09 EST


2012/6/26 Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>:
> Lots of regulator drivers have checks in their map_voltage() functions
> to verify that the result of the mapping is in the range originally
> specified. Factor these out in the core and provide a bit of extra
> defensiveness for other drivers by doing the check in the core.
>
> Since we're now doing a list_voltage() earlier move the current mapping
> back to a voltage out into the set_voltage() call to save redoing it.
>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Hi Mark,
This patch does not apply to both linux-next tree and regulator tree
(for-next branch).

I got below diff in drivers/regulator/core.c.rej.

--- drivers/regulator/core.c
+++ drivers/regulator/core.c
@@ -2119,10 +2128,8 @@
}

if (ret >= 0) {
- if (min_uV < rdev->desc->ops->list_voltage(rdev,
- ret) &&
- max_uV > rdev->desc->ops->list_voltage(rdev,
- ret)) {
+ best_val = rdev->desc->ops->list_voltage(rdev, ret);
+ if (min_uV <= best_val && max_uV >= best_val) {
selector = ret;
ret = rdev->desc->ops->set_voltage_sel(rdev,
ret);

Regards,
Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/