regulator: core: Check that the selector from map_voltage() is valid
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 26 Jun 2012 09:57:51 +0000 (10:57 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 3 Jul 2012 19:28:04 +0000 (20:28 +0100)
commite113d792d56d4b720b3d84c122b6af84c3bfa094
tree3dbf10393fed4c59569afc93f777b96e0d9b0af4
parentc5f3939b8fe0c358d35397982e5afdef112afc81
regulator: core: Check that the selector from map_voltage() is valid

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@opensource.wolfsonmicro.com>
drivers/regulator/core.c