linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tharvey@gateworks.com (Tim Harvey)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] regulator: add function to determine if 2 regulators are the same
Date: Thu, 30 Oct 2014 21:27:07 -0700	[thread overview]
Message-ID: <1414729631-11005-2-git-send-email-tharvey@gateworks.com> (raw)
In-Reply-To: <1414729631-11005-1-git-send-email-tharvey@gateworks.com>

Regulator structures can point to the same internal regulator dev's but as
that information is private we need to expose a function to determine if
two regulators do so.

Cc: linux-pm at vger.kernel.org
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/regulator/core.c           | 17 +++++++++++++++++
 include/linux/regulator/consumer.h |  8 ++++++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cd87c0c..6d4a627 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2184,6 +2184,23 @@ int regulator_is_enabled(struct regulator *regulator)
 EXPORT_SYMBOL_GPL(regulator_is_enabled);
 
 /**
+ * regulator_is_same - are two regulators the same
+ * @regulator1: regulator source
+ * @regulator2: regulator source
+ *
+ * Returns positive if both regulators point to the same regulator_dev.
+ */
+int regulator_is_same(struct regulator *regulator1,
+		      struct regulator *regulator2)
+{
+	if (!regulator1 || !regulator2)
+		return -EINVAL;
+
+	return (regulator1->rdev == regulator2->rdev) ? 1 : 0;
+}
+EXPORT_SYMBOL_GPL(regulator_is_same);
+
+/**
  * regulator_can_change_voltage - check if regulator can change voltage
  * @regulator: regulator source
  *
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index d347c80..972090a 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -200,6 +200,8 @@ int __must_check regulator_enable(struct regulator *regulator);
 int regulator_disable(struct regulator *regulator);
 int regulator_force_disable(struct regulator *regulator);
 int regulator_is_enabled(struct regulator *regulator);
+int regulator_is_same(struct regulator *regulator1,
+		      struct regulator *regulator2);
 int regulator_disable_deferred(struct regulator *regulator, int ms);
 
 int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
@@ -387,6 +389,12 @@ static inline int regulator_is_enabled(struct regulator *regulator)
 	return 1;
 }
 
+static inline int regulator_is_same(struct regulator *regulator1,
+				    struct regulator *regulator2)
+{
+	return 0;
+}
+
 static inline int regulator_bulk_get(struct device *dev,
 				     int num_consumers,
 				     struct regulator_bulk_data *consumers)
-- 
1.8.3.2

  reply	other threads:[~2014-10-31  4:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31  4:27 [PATCH 0/5] ARM: imx: ventana: enable LDO-bypass mode Tim Harvey
2014-10-31  4:27 ` Tim Harvey [this message]
2014-10-31  4:27 ` [PATCH 2/5] regulator: add function to determine if a regulator is in bypass mode Tim Harvey
2014-10-31  4:27 ` [PATCH 3/5] ARM: dts: imx: add cpu0 alias Tim Harvey
2014-10-31  4:27 ` [PATCH 4/5] cpufreq: imx6q: add ldo-bypass support Tim Harvey
2014-12-17 14:36   ` Fabio Estevam
2014-12-18 14:11     ` Tim Harvey
2014-12-18 14:22       ` Mark Brown
2014-12-19 16:17         ` Tim Harvey
2014-12-19 16:23           ` Mark Brown
2015-01-05 14:38             ` Tim Harvey
2015-01-05 14:43               ` Mark Brown
2014-10-31  4:27 ` [PATCH 5/5] ARM: imx: ventana: enable LDO bypass mode for GW54xx Tim Harvey
2015-02-24 21:36 ` [PATCH 0/5] ARM: imx: ventana: enable LDO-bypass mode Jean-Michel Hautbois
     [not found]   ` <CAJ+vNU3-Q2LkGDau1c6rXTaGkP9c3-RC-OuHiTvv=DETKvnDaw@mail.gmail.com>
2015-03-24 15:27     ` Jean-Michel Hautbois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414729631-11005-2-git-send-email-tharvey@gateworks.com \
    --to=tharvey@gateworks.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).