From: Laxman Dewangan <ldewangan@nvidia.com>
To: <sameo@linux.intel.com>, <lrg@ti.com>,
<broonie@opensource.wolfsonmicro.com>
Cc: <linux-kernel@vger.kernel.org>, <swarren@wwwdotorg.org>,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V2] regulator: tps6586x: register regulator even if no init data
Date: Wed, 29 Aug 2012 20:31:13 +0530 [thread overview]
Message-ID: <1346252473-30068-1-git-send-email-ldewangan@nvidia.com> (raw)
Register all TPS6586x regulators even if there is no regulator
init data for platform i.e. without any user-supplied constraints.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Changes from V1:
Stephen pointed out that the pointer in if should be same what it
is used inside the if statements.
Making the change to address this.
drivers/mfd/tps6586x.c | 16 ++++++++--------
drivers/regulator/tps6586x-regulator.c | 3 +++
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 380a3c8..4a91a62 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -396,19 +396,19 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien
for (i = 0, j = 0; i < num && j < count; i++) {
struct regulator_init_data *reg_idata;
- if (!tps6586x_matches[i].init_data)
- continue;
-
reg_idata = tps6586x_matches[i].init_data;
devs[j].name = "tps6586x-regulator";
devs[j].platform_data = tps6586x_matches[i].init_data;
devs[j].id = (int)tps6586x_matches[i].driver_data;
- if (devs[j].id == TPS6586X_ID_SYS)
- sys_rail_name = reg_idata->constraints.name;
- if ((devs[j].id == TPS6586X_ID_LDO_5) ||
- (devs[j].id == TPS6586X_ID_LDO_RTC))
- reg_idata->supply_regulator = sys_rail_name;
+ if (reg_idata) {
+ if (devs[j].id == TPS6586X_ID_SYS)
+ sys_rail_name = reg_idata->constraints.name;
+
+ if ((devs[j].id == TPS6586X_ID_LDO_5) ||
+ (devs[j].id == TPS6586X_ID_LDO_RTC))
+ reg_idata->supply_regulator = sys_rail_name;
+ }
devs[j].of_node = tps6586x_matches[i].of_node;
j++;
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index ce1e7cb..4508222 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -332,6 +332,9 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rdev);
+ if (!pdev->dev.platform_data)
+ return 0;
+
return tps6586x_regulator_set_slew_rate(pdev);
}
--
1.7.1.1
next reply other threads:[~2012-08-29 15:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 15:01 Laxman Dewangan [this message]
2012-08-29 17:38 ` [PATCH V2] regulator: tps6586x: register regulator even if no init data Stephen Warren
2012-09-04 20:47 ` Stephen Warren
2012-09-05 8:02 ` Laxman Dewangan
2012-09-05 15:33 ` Stephen Warren
2012-09-06 11:31 ` Laxman Dewangan
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=1346252473-30068-1-git-send-email-ldewangan@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sameo@linux.intel.com \
--cc=swarren@wwwdotorg.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).