2013-05-29 11:45:40

by Nikolay Balandin

[permalink] [raw]
Subject: [PATCH v1 1/1] drivers/misc: lis3lv02d: convert to use devm_regulator_bulk_get

From: Nikolay Balandin <[email protected]>

Use devm_regulator_bulk_get to make cleanup paths simpler

Signed-off-by: Nikolay Balandin <[email protected]>
---
drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
index 7c97550..01ddcf0 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
@@ -154,7 +154,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client,

lis3_dev.regulators[0].supply = reg_vdd;
lis3_dev.regulators[1].supply = reg_vdd_io;
- ret = regulator_bulk_get(&client->dev,
+ ret = devm_regulator_bulk_get(&client->dev,
ARRAY_SIZE(lis3_dev.regulators),
lis3_dev.regulators);
if (ret < 0)
@@ -179,12 +179,9 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client,
lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);

if (ret)
- goto fail2;
+ goto fail;
return 0;

-fail2:
- regulator_bulk_free(ARRAY_SIZE(lis3_dev.regulators),
- lis3_dev.regulators);
fail:
if (pdata && pdata->release_resources)
pdata->release_resources();
@@ -202,8 +199,6 @@ static int lis3lv02d_i2c_remove(struct i2c_client *client)
lis3lv02d_joystick_disable(lis3);
lis3lv02d_remove_fs(&lis3_dev);

- regulator_bulk_free(ARRAY_SIZE(lis3->regulators),
- lis3_dev.regulators);
return 0;
}

--
1.7.9.5


2013-05-29 19:15:26

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] drivers/misc: lis3lv02d: convert to use devm_regulator_bulk_get

On Wed, May 29, 2013 at 2:45 PM, Nikolay Balandin
<[email protected]> wrote:
> From: Nikolay Balandin <[email protected]>
>
> Use devm_regulator_bulk_get to make cleanup paths simpler

Do you plan to use this driver somewhere outside of Nokia n900 device?
If so, there is more than this clean up to do.

Otherwise I don't think we have to touch that driver at all.

--
With Best Regards,
Andy Shevchenko

2013-05-30 11:55:20

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] drivers/misc: lis3lv02d: convert to use devm_regulator_bulk_get

On Thu, May 30, 2013 at 10:03 AM, Nikolay Balandin
<[email protected]> wrote:

> Yes, this accelerometer is present on the Kontron SMARC evaluation
> carrier.
> http://emea.kontron.com/products/computeronmodules/smarc/smarc+evaluation+carrier.html

Good.

I think you may do following things:
- update lis3lv02d.c to use devm_* functions
- and then update i2c driver to use devm_*

Are you going to support that platform via DeviceTree model?

> On Wed, May 29, 2013 at 2:45 PM, Nikolay Balandin
> <[email protected]> wrote:
> Use devm_regulator_bulk_get to make cleanup paths simpler
>
> Do you plan to use this driver somewhere outside of Nokia n900 device?
> If so, there is more than this clean up to do.
>
> Otherwise I don't think we have to touch that driver at all.


--
With Best Regards,
Andy Shevchenko