LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Kumar Gala <galak@codeaurora.org>,
	Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Pawel Moll <pawel.moll@arm.com>, Rob Herring <robh+dt@kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Andy Gross <agross@codeaurora.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>
Subject: [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb
Date: Mon, 2 Mar 2015 20:25:38 -0800	[thread overview]
Message-ID: <1425356740-26285-3-git-send-email-bjorn.andersson@sonymobile.com> (raw)
In-Reply-To: <1425356740-26285-1-git-send-email-bjorn.andersson@sonymobile.com>

Expose the newly created init_data to the driver's parse callback so
that it can futher enhance it with e.g. constraints of the regulator.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---

This is needed because calling regulator_register() with a of_node and
of_match will overwrite the passed config->init_data. An alternative way
would be to merge the parsed init_data with the driver provided one.

 drivers/regulator/max77686.c     | 3 ++-
 drivers/regulator/of_regulator.c | 2 +-
 include/linux/regulator/driver.h | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index 15fb141..87cbef2 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -259,7 +259,8 @@ static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
 
 static int max77686_of_parse_cb(struct device_node *np,
 		const struct regulator_desc *desc,
-		struct regulator_config *config)
+		struct regulator_config *config,
+		struct regulator_init_data *init_data)
 {
 	struct max77686_data *max77686 = config->driver_data;
 
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 24e812c..f65934f 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -309,7 +309,7 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
 		}
 
 		if (desc->of_parse_cb) {
-			if (desc->of_parse_cb(child, desc, config)) {
+			if (desc->of_parse_cb(child, desc, config, init_data)) {
 				dev_err(dev,
 					"driver callback failed to parse DT for regulator %s\n",
 					child->name);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 8a0165f..0f86a182 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -266,7 +266,8 @@ struct regulator_desc {
 	const char *regulators_node;
 	int (*of_parse_cb)(struct device_node *,
 			    const struct regulator_desc *,
-			    struct regulator_config *);
+			    struct regulator_config *,
+			    struct regulator_init_data *);
 	int id;
 	bool continuous_voltage_range;
 	unsigned n_voltages;
-- 
1.8.2.2


  parent reply	other threads:[~2015-03-03 11:31 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  4:25 [PATCH 0/4] Refactor Qualcomm RPM regulator to single platform_device Bjorn Andersson
2015-03-03  4:25 ` [PATCH 1/4] mfd: devicetree: bindings: Add Qualcomm RPM regulator subnodes Bjorn Andersson
2015-03-03 12:47   ` Mark Brown
2015-03-03 16:02     ` Bjorn Andersson
2015-03-05  0:33       ` Mark Brown
2015-03-03 18:53   ` Stephen Boyd
2015-03-03 21:54     ` Bjorn Andersson
2015-03-03 22:02       ` Stephen Boyd
2015-03-03 22:17         ` Bjorn Andersson
2015-03-03 23:25           ` Stephen Boyd
2015-03-03  4:25 ` Bjorn Andersson [this message]
2015-03-03 12:50   ` [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb Mark Brown
2015-03-03 16:15     ` Bjorn Andersson
2015-03-05  0:42       ` Mark Brown
2015-03-03  4:25 ` [PATCH 3/4] regulator: qcom: Refactor of-parsing code Bjorn Andersson
2015-03-03 14:13   ` Mark Brown
2015-03-03 16:26     ` Bjorn Andersson
2015-03-03 18:56   ` Stephen Boyd
2015-03-03 22:07     ` Bjorn Andersson
2015-03-03  4:25 ` [PATCH 4/4] regulator: qcom: Rework to single platform device Bjorn Andersson
2015-03-03 22:09   ` Stephen Boyd
2015-03-03 22:32     ` Bjorn Andersson
2015-03-03 23:52       ` Mark Brown
2015-03-04  0:01         ` Stephen Boyd
2015-03-04  0:09           ` Mark Brown
2015-03-04 19:35   ` Stephen Boyd
2015-03-04 23:51     ` Bjorn Andersson
2015-03-05  0:56       ` Mark Brown
2015-03-05  0:30     ` Mark Brown
2015-03-05  1:46       ` Stephen Boyd
2015-03-05 10:38         ` Mark Brown

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=1425356740-26285-3-git-send-email-bjorn.andersson@sonymobile.com \
    --to=bjorn.andersson@sonymobile.com \
    --cc=agross@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=k.kozlowski@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=srinivas.kandagatla@linaro.org \
    --subject='Re: [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb' \
    /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

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).