From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Jonghwa Lee <jonghwa3.lee@samsung.com>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev
Date: Sun, 09 Mar 2014 15:27:12 +0800 [thread overview]
Message-ID: <1394350032.19772.1.camel@phoenix> (raw)
Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
array to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/max77693.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index d6807fd..f5f85c2 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -38,7 +38,6 @@ struct max77693_pmic_dev {
struct device *dev;
struct max77693_dev *iodev;
int num_regulators;
- struct regulator_dev **rdev;
};
/* CHARGER regulator ops */
@@ -249,12 +248,6 @@ static int max77693_pmic_probe(struct platform_device *pdev)
if (!max77693_pmic)
return -ENOMEM;
- max77693_pmic->rdev = devm_kzalloc(&pdev->dev,
- sizeof(struct regulator_dev *) * num_rdata,
- GFP_KERNEL);
- if (!max77693_pmic->rdev)
- return -ENOMEM;
-
max77693_pmic->dev = &pdev->dev;
max77693_pmic->iodev = iodev;
max77693_pmic->num_regulators = num_rdata;
@@ -265,17 +258,18 @@ static int max77693_pmic_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, max77693_pmic);
for (i = 0; i < max77693_pmic->num_regulators; i++) {
+ struct regulator_dev *rdev;
int id = rdata[i].id;
config.init_data = rdata[i].initdata;
config.of_node = rdata[i].of_node;
- max77693_pmic->rdev[i] = devm_regulator_register(&pdev->dev,
- ®ulators[id], &config);
- if (IS_ERR(max77693_pmic->rdev[i])) {
+ rdev = devm_regulator_register(&pdev->dev, ®ulators[id],
+ &config);
+ if (IS_ERR(rdev)) {
dev_err(max77693_pmic->dev,
"Failed to initialize regulator-%d\n", id);
- return PTR_ERR(max77693_pmic->rdev[i]);
+ return PTR_ERR(rdev);
}
}
--
1.8.1.2
next reply other threads:[~2014-03-09 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-09 7:27 Axel Lin [this message]
2014-03-09 7:29 ` [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data Axel Lin
2014-03-10 10:11 ` Mark Brown
2014-03-09 7:32 ` [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data Axel Lin
2014-03-10 10:12 ` Mark Brown
2014-03-10 12:14 ` [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev 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=1394350032.19772.1.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=jonghwa3.lee@samsung.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.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