All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: Provide a check for dummy regulator
@ 2012-04-19  9:51 Jassi Brar
  2012-04-19 12:42 ` Mark Brown
  0 siblings, 1 reply; 15+ messages in thread
From: Jassi Brar @ 2012-04-19  9:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: lrg, broonie, Jassi Brar

Usually changing the regulator output involves delays before/after the
operation.
There are consumer drivers shared by platforms, where some may
not really have a regulator in the path. Which causes the consumer
to unnecessarily (sometimes disruptively) incur delays for the
"dummy" regulator.
Since the 'struct regulator' is opaque outside of the core,
provide a function to check if the given regulator is a dummy one.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
 drivers/regulator/core.c           |    9 +++++++++
 include/linux/regulator/consumer.h |    6 ++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e70dd38..2fb6e5b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3115,6 +3115,15 @@ void regulator_use_dummy_regulator(void)
 EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);
 
 /**
+ * regulator_is_dummy - Check if the regulator is the placeholder 'dummy'
+ */
+bool regulator_is_dummy(struct regulator *regulator)
+{
+	return !strcmp(regulator->rdev->desc->name, "dummy");
+}
+EXPORT_SYMBOL_GPL(regulator_is_dummy);
+
+/**
  * rdev_get_drvdata - get rdev regulator driver data
  * @rdev: regulator
  *
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 4ed1b30..7b0360c 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -141,6 +141,7 @@ void regulator_put(struct regulator *regulator);
 void devm_regulator_put(struct regulator *regulator);
 
 /* regulator output control and status */
+bool regulator_is_dummy(struct regulator *regulator);
 int regulator_enable(struct regulator *regulator);
 int regulator_disable(struct regulator *regulator);
 int regulator_force_disable(struct regulator *regulator);
@@ -221,6 +222,11 @@ static inline void devm_regulator_put(struct regulator *regulator)
 {
 }
 
+static bool regulator_is_dummy(struct regulator *regulator)
+{
+	return true;
+}
+
 static inline int regulator_enable(struct regulator *regulator)
 {
 	return 0;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-04-20 22:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19  9:51 [PATCH] regulator: Provide a check for dummy regulator Jassi Brar
2012-04-19 12:42 ` Mark Brown
2012-04-19 14:05   ` Jassi Brar
2012-04-19 16:29     ` Mark Brown
2012-04-20  7:32       ` Jassi Brar
2012-04-20 11:46         ` Mark Brown
2012-04-20 12:29           ` Jassi Brar
2012-04-20 13:01             ` Mark Brown
2012-04-20 13:48               ` Jassi Brar
2012-04-20 14:13                 ` Jassi Brar
2012-04-20 14:42                 ` Mark Brown
2012-04-20 18:25                   ` Jassi Brar
2012-04-20 18:48                     ` Mark Brown
2012-04-20 19:11                       ` Jassi Brar
2012-04-20 22:04                         ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.