diff mbox

[V2,1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR

Message ID 788accde56086078d69d3eba0d913114315de43a.1401693980.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar June 2, 2014, 7:29 a.m. UTC
Currently regulator_set_voltage() returns zero when support for regulators isn't
present in kernel, i.e. CONFIG_REGULATOR=n.

Make it return -EINVAL to propagate error instead of success here.
Audit of all users of this routine is done to make sure nothing breaks due to
this change.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V1->V2: - New patch as suggested by Mark.

 include/linux/regulator/consumer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki June 2, 2014, 12:15 p.m. UTC | #1
On Monday, June 02, 2014 12:59:23 PM Viresh Kumar wrote:
> Currently regulator_set_voltage() returns zero when support for regulators isn't
> present in kernel, i.e. CONFIG_REGULATOR=n.
> 
> Make it return -EINVAL to propagate error instead of success here.
> Audit of all users of this routine is done to make sure nothing breaks due to
> this change.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Well, I'd say this patch series is for Mark and I'm fine with patch [3/3].

Thanks!

> ---
> V1->V2: - New patch as suggested by Mark.
> 
>  include/linux/regulator/consumer.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
> index 1a4a8c1..28fa089 100644
> --- a/include/linux/regulator/consumer.h
> +++ b/include/linux/regulator/consumer.h
> @@ -394,7 +394,7 @@ static inline void regulator_bulk_free(int num_consumers,
>  static inline int regulator_set_voltage(struct regulator *regulator,
>  					int min_uV, int max_uV)
>  {
> -	return 0;
> +	return -EINVAL;
>  }
>  
>  static inline int regulator_get_voltage(struct regulator *regulator)
>
diff mbox

Patch

diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 1a4a8c1..28fa089 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -394,7 +394,7 @@  static inline void regulator_bulk_free(int num_consumers,
 static inline int regulator_set_voltage(struct regulator *regulator,
 					int min_uV, int max_uV)
 {
-	return 0;
+	return -EINVAL;
 }
 
 static inline int regulator_get_voltage(struct regulator *regulator)