* [PATCH v5 4/5] Regulator: RK808: modify for struct rk808 change
@ 2014-08-25 13:37 Chris Zhong
2014-08-26 7:30 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Chris Zhong @ 2014-08-25 13:37 UTC (permalink / raw)
To: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, sameo,
lee.jones, lgirdwood, broonie, a.zummo, mturquette
Cc: devicetree, linux-kernel, rtc-linux, grant.likely, hl, huangtao,
cf, zhangqing, xxx, dianders, heiko, olof, sonnyrao, dtor,
javier.martinez, kever.yang, Chris Zhong
The "dev" has been deleted from "struct rk808" in rk808 mfd driver
so rk808->dev should be replaced by &client->dev here.
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
---
Changes in v5: None
Changes in v4:
Adviced by Lee Jones in v2
- modify the description in Kconfig
- remove some unnecessary header files
- remove dev from struct rk808
- use enum for define RK808_ID...
Changes in v3:
- fix compile err
Changes in v2:
Adviced by Mark Browm:
- use defines for register setting value
- remove rtc alarm disable in shutdown
- remove while(1) in shutdown
- remove read 0x2f in probe
drivers/regulator/rk808-regulator.c | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 4d5041c..f00d6d8 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -296,13 +296,14 @@ static struct of_regulator_match rk808_reg_matches[] = {
static int rk808_regulator_dts(struct rk808 *rk808)
{
- struct rk808_board *pdata = rk808->pdata;
struct device_node *np, *reg_np;
+ struct i2c_client *client = rk808->i2c;
+ struct rk808_board *pdata = rk808->pdata;
int i, ret;
- np = rk808->dev->of_node;
+ np = client->dev.of_node;
if (!np) {
- dev_err(rk808->dev, "could not find pmic sub-node\n");
+ dev_err(&client->dev, "could not find pmic sub-node\n");
return -ENXIO;
}
@@ -310,10 +311,10 @@ static int rk808_regulator_dts(struct rk808 *rk808)
if (!reg_np)
return -ENXIO;
- ret = of_regulator_match(rk808->dev, reg_np, rk808_reg_matches,
+ ret = of_regulator_match(&client->dev, reg_np, rk808_reg_matches,
RK808_NUM_REGULATORS);
- if (ret < 0) {
- dev_err(rk808->dev,
+ if (ret < 0) {
+ dev_err(&client->dev,
"failed to parse regulator data: %d\n", ret);
return ret;
}
@@ -333,24 +334,17 @@ static int rk808_regulator_dts(struct rk808 *rk808)
static int rk808_regulator_probe(struct platform_device *pdev)
{
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
- struct rk808_board *pdata;
+ struct i2c_client *client = rk808->i2c;
+ struct rk808_board *pdata = rk808->pdata;
struct regulator_config config = {};
struct regulator_dev *rk808_rdev;
struct regulator_init_data *reg_data;
int i = 0;
int ret = 0;
- dev_dbg(rk808->dev, "%s\n", __func__);
-
- if (!rk808) {
- dev_err(rk808->dev, "%s no rk808\n", __func__);
- return -ENODEV;
- }
-
- pdata = rk808->pdata;
if (!pdata) {
- dev_warn(rk808->dev, "%s no pdata, create it\n", __func__);
- pdata = devm_kzalloc(rk808->dev, sizeof(*pdata), GFP_KERNEL);
+ dev_warn(&client->dev, "%s no pdata, create it\n", __func__);
+ pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
}
@@ -371,11 +365,11 @@ static int rk808_regulator_probe(struct platform_device *pdev)
if (!reg_data)
continue;
- config.dev = rk808->dev;
+ config.dev = &client->dev;
config.driver_data = rk808;
config.regmap = rk808->regmap;
- if (rk808->dev->of_node)
+ if (client->dev.of_node)
config.of_node = pdata->of_node[i];
reg_data->supply_regulator = rk808_reg[i].name;
@@ -384,7 +378,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
rk808_rdev = devm_regulator_register(&pdev->dev,
&rk808_reg[i], &config);
if (IS_ERR(rk808_rdev)) {
- dev_err(rk808->dev,
+ dev_err(&client->dev,
"failed to register %d regulator\n", i);
return PTR_ERR(rk808_rdev);
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v5 4/5] Regulator: RK808: modify for struct rk808 change
2014-08-25 13:37 [PATCH v5 4/5] Regulator: RK808: modify for struct rk808 change Chris Zhong
@ 2014-08-26 7:30 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-08-26 7:30 UTC (permalink / raw)
To: Chris Zhong
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, sameo,
lee.jones, lgirdwood, a.zummo, mturquette, devicetree,
linux-kernel, rtc-linux, grant.likely, hl, huangtao, cf,
zhangqing, xxx, dianders, heiko, olof, sonnyrao, dtor,
javier.martinez, kever.yang
[-- Attachment #1: Type: text/plain, Size: 205 bytes --]
On Mon, Aug 25, 2014 at 09:37:06PM +0800, Chris Zhong wrote:
> The "dev" has been deleted from "struct rk808" in rk808 mfd driver
> so rk808->dev should be replaced by &client->dev here.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-26 7:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-25 13:37 [PATCH v5 4/5] Regulator: RK808: modify for struct rk808 change Chris Zhong
2014-08-26 7:30 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®