* [PATCH] regulator: max8660: Remove regulator_dev pointer from state container
@ 2014-03-10 9:37 Krzysztof Kozlowski
2014-03-10 9:46 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2014-03-10 9:37 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, linux-kernel; +Cc: Krzysztof Kozlowski
Don't store pointer to regulator_dev returned by
devm_regulator_register() in state container. It isn't used anywhere
outside of max8660_probe() function.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/regulator/max8660.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 8d94d3d7f97f..36fb1060cd7b 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -81,7 +81,6 @@ enum {
struct max8660 {
struct i2c_client *client;
u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */
- struct regulator_dev *rdev[];
};
static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val)
@@ -373,7 +372,6 @@ static inline int max8660_pdata_from_dt(struct device *dev,
static int max8660_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id)
{
- struct regulator_dev **rdev;
struct device *dev = &client->dev;
struct max8660_platform_data *pdata = dev_get_platdata(dev);
struct regulator_config config = { };
@@ -406,14 +404,11 @@ static int max8660_probe(struct i2c_client *client,
return -EINVAL;
}
- max8660 = devm_kzalloc(dev, sizeof(struct max8660) +
- sizeof(struct regulator_dev *) * MAX8660_V_END,
- GFP_KERNEL);
+ max8660 = devm_kzalloc(dev, sizeof(struct max8660), GFP_KERNEL);
if (!max8660)
return -ENOMEM;
max8660->client = client;
- rdev = max8660->rdev;
if (pdata->en34_is_high) {
/* Simulate always on */
@@ -481,6 +476,7 @@ static int max8660_probe(struct i2c_client *client,
/* Finally register devices */
for (i = 0; i < pdata->num_subdevs; i++) {
+ struct regulator_dev *rdev;
id = pdata->subdevs[i].id;
@@ -489,13 +485,13 @@ static int max8660_probe(struct i2c_client *client,
config.of_node = of_node[i];
config.driver_data = max8660;
- rdev[i] = devm_regulator_register(&client->dev,
+ rdev = devm_regulator_register(&client->dev,
&max8660_reg[id], &config);
- if (IS_ERR(rdev[i])) {
- ret = PTR_ERR(rdev[i]);
+ if (IS_ERR(rdev)) {
+ ret = PTR_ERR(rdev);
dev_err(&client->dev, "failed to register %s\n",
max8660_reg[id].name);
- return PTR_ERR(rdev[i]);
+ return PTR_ERR(rdev);
}
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: max8660: Remove regulator_dev pointer from state container
2014-03-10 9:37 [PATCH] regulator: max8660: Remove regulator_dev pointer from state container Krzysztof Kozlowski
@ 2014-03-10 9:46 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-03-10 9:46 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 248 bytes --]
On Mon, Mar 10, 2014 at 10:37:19AM +0100, Krzysztof Kozlowski wrote:
> Don't store pointer to regulator_dev returned by
> devm_regulator_register() in state container. It isn't used anywhere
> outside of max8660_probe() function.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-10 9:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 9:37 [PATCH] regulator: max8660: Remove regulator_dev pointer from state container Krzysztof Kozlowski
2014-03-10 9:46 ` 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®