* [PATCH] regulator: add regulator_bulk_force_disable function
@ 2012-01-03 7:22 Donggeun Kim
2012-01-03 20:20 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Donggeun Kim @ 2012-01-03 7:22 UTC (permalink / raw)
To: linux-kernel; +Cc: lrg, broonie, myungjoo.ham, kyungmin.park, dg77.kim
This patch allows consumers to forcibly disable multiple regulator
clients in a single API call.
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/regulator/core.c | 37 ++++++++++++++++++++++++++++++++++++
include/linux/regulator/consumer.h | 8 +++++++
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 938398f..31a5d29 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2429,6 +2429,43 @@ err:
EXPORT_SYMBOL_GPL(regulator_bulk_disable);
/**
+ * regulator_bulk_force_disable - force disable multiple regulator consumers
+ *
+ * @num_consumers: Number of consumers
+ * @consumers: Consumer data; clients are stored here.
+ * @return 0 on success, an errno on failure
+ *
+ * This convenience API allows consumers to forcibly disable multiple regulator
+ * clients in a single API call.
+ * NOTE: This should be used for situations when device damage will
+ * likely occur if the regulators are not disabled (e.g. over temp).
+ * Although regulator_force_disable function call for some consumers can
+ * return error numbers, the function is called for all consumers.
+ */
+int regulator_bulk_force_disable(int num_consumers,
+ struct regulator_bulk_data *consumers)
+{
+ int i;
+ int ret;
+
+ for (i = 0; i < num_consumers; i++)
+ consumers[i].ret =
+ regulator_force_disable(consumers[i].consumer);
+
+ for (i = 0; i < num_consumers; i++) {
+ if (consumers[i].ret != 0) {
+ ret = consumers[i].ret;
+ goto out;
+ }
+ }
+
+ return 0;
+out:
+ return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_force_disable);
+
+/**
* regulator_bulk_free - free multiple regulator consumers
*
* @num_consumers: Number of consumers
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f7756d1..442c7f5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -149,6 +149,8 @@ int regulator_bulk_enable(int num_consumers,
struct regulator_bulk_data *consumers);
int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers);
+int regulator_bulk_force_disable(int num_consumers,
+ struct regulator_bulk_data *consumers);
void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers);
@@ -242,6 +244,12 @@ static inline int regulator_bulk_disable(int num_consumers,
return 0;
}
+static inline int regulator_bulk_force_disable(int num_consumers,
+ struct regulator_bulk_data *consumers)
+{
+ return 0;
+}
+
static inline void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers)
{
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: add regulator_bulk_force_disable function
2012-01-03 7:22 [PATCH] regulator: add regulator_bulk_force_disable function Donggeun Kim
@ 2012-01-03 20:20 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-01-03 20:20 UTC (permalink / raw)
To: Donggeun Kim; +Cc: linux-kernel, lrg, myungjoo.ham, kyungmin.park
On Tue, Jan 03, 2012 at 04:22:03PM +0900, Donggeun Kim wrote:
> This patch allows consumers to forcibly disable multiple regulator
> clients in a single API call.
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-03 20:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-03 7:22 [PATCH] regulator: add regulator_bulk_force_disable function Donggeun Kim
2012-01-03 20:20 ` Mark Brown
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).