* [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR
@ 2014-06-02 7:29 Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 2/3] regulators: Add definition of regulator_set_voltage_time() " Viresh Kumar
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-06-02 7:29 UTC (permalink / raw)
To: rjw
Cc: linaro-kernel, linux-pm, linux-kernel, arvind.chauhan, edubezval,
pavel, lgirdwood, broonie, Viresh Kumar
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(-)
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)
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 2/3] regulators: Add definition of regulator_set_voltage_time() for !CONFIG_REGULATOR
2014-06-02 7:29 [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Viresh Kumar
@ 2014-06-02 7:29 ` Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 3/3] cpufreq: cpufreq-cpu0: remove dependency on THERMAL and REGULATOR Viresh Kumar
2014-06-02 12:15 ` [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-06-02 7:29 UTC (permalink / raw)
To: rjw
Cc: linaro-kernel, linux-pm, linux-kernel, arvind.chauhan, edubezval,
pavel, lgirdwood, broonie, Viresh Kumar
We already have dummy implementation for most of the regulators APIs for
!CONFIG_REGULATOR case and were missing it for regulator_set_voltage_time().
Found this issue while compiling cpufreq-cpu0 driver without regulators support
in kernel.
drivers/cpufreq/cpufreq-cpu0.c: In function ‘cpu0_cpufreq_probe’:
drivers/cpufreq/cpufreq-cpu0.c:186:3: error: implicit declaration of function ‘regulator_set_voltage_time’ [-Werror=implicit-function-declaration]
Fix this by adding dummy definition for regulator_set_voltage_time().
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V1->V2: return -EINVAL instead of zero.
include/linux/regulator/consumer.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 28fa089..7563f8b 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -397,6 +397,12 @@ static inline int regulator_set_voltage(struct regulator *regulator,
return -EINVAL;
}
+static inline int regulator_set_voltage_time(struct regulator *regulator,
+ int old_uV, int new_uV)
+{
+ return -EINVAL;
+}
+
static inline int regulator_get_voltage(struct regulator *regulator)
{
return -EINVAL;
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 3/3] cpufreq: cpufreq-cpu0: remove dependency on THERMAL and REGULATOR
2014-06-02 7:29 [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 2/3] regulators: Add definition of regulator_set_voltage_time() " Viresh Kumar
@ 2014-06-02 7:29 ` Viresh Kumar
2014-06-02 12:15 ` [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-06-02 7:29 UTC (permalink / raw)
To: rjw
Cc: linaro-kernel, linux-pm, linux-kernel, arvind.chauhan, edubezval,
pavel, lgirdwood, broonie, Viresh Kumar, Shawn Guo
cpufreq-cpu0 uses thermal framework to register a cooling device, but doesn't
depend on it as there are dummy calls provided by thermal layer when
CONFIG_THERMAL=n. And when these calls fail, the driver is still usable.
Similar explanation is valid for regulators as well. We do have dummy calls
available for regulator APIs and the driver can work even when those calls
fail.
So, we don't really need to mention thermal and regulators as a dependency for
cpufreq-cpu0 in Kconfig. Remove it.
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V1->V2: No change.
drivers/cpufreq/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 1fbe11f..e473d65 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -185,7 +185,7 @@ config CPU_FREQ_GOV_CONSERVATIVE
config GENERIC_CPUFREQ_CPU0
tristate "Generic CPU0 cpufreq driver"
- depends on HAVE_CLK && REGULATOR && OF && THERMAL && CPU_THERMAL
+ depends on HAVE_CLK && OF
select PM_OPP
help
This adds a generic cpufreq driver for CPU0 frequency management.
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR
2014-06-02 7:29 [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 2/3] regulators: Add definition of regulator_set_voltage_time() " Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 3/3] cpufreq: cpufreq-cpu0: remove dependency on THERMAL and REGULATOR Viresh Kumar
@ 2014-06-02 12:15 ` Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-06-02 12:15 UTC (permalink / raw)
To: Viresh Kumar
Cc: linaro-kernel, linux-pm, linux-kernel, arvind.chauhan, edubezval,
pavel, lgirdwood, broonie
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)
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-02 11:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-02 7:29 [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 2/3] regulators: Add definition of regulator_set_voltage_time() " Viresh Kumar
2014-06-02 7:29 ` [PATCH V2 3/3] cpufreq: cpufreq-cpu0: remove dependency on THERMAL and REGULATOR Viresh Kumar
2014-06-02 12:15 ` [PATCH V2 1/3] regulator: return -EINVAL from regulator_set_voltage() for !CONFIG_REGULATOR Rafael J. Wysocki
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).