summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/m5mols/m5mols_core.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 08:29:43 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 07:53:18 -0300
commitb015ba29ca09b0e3750b4de365d3baf9c5b11450 (patch)
treebc512024bb642bc2058473c6f73fb45b7a5712c0 /drivers/media/i2c/m5mols/m5mols_core.c
parentc02b211df6fc54e51ee554c27a6736a11255a764 (diff)
downloadblackbird-op-linux-b015ba29ca09b0e3750b4de365d3baf9c5b11450.tar.gz
blackbird-op-linux-b015ba29ca09b0e3750b4de365d3baf9c5b11450.zip
[media] media: i2c: Convert to devm_gpio_request_one()
Using the managed function the gpio_free() calls can be removed from the probe error path and the remove handler. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/m5mols/m5mols_core.c')
-rw-r--r--drivers/media/i2c/m5mols/m5mols_core.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index 08ff082242c3..f870d5057e3d 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -959,7 +959,8 @@ static int m5mols_probe(struct i2c_client *client,
gpio_flags = pdata->reset_polarity
? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
- ret = gpio_request_one(pdata->gpio_reset, gpio_flags, "M5MOLS_NRST");
+ ret = devm_gpio_request_one(&client->dev, pdata->gpio_reset, gpio_flags,
+ "M5MOLS_NRST");
if (ret) {
dev_err(&client->dev, "Failed to request gpio: %d\n", ret);
return ret;
@@ -968,7 +969,7 @@ static int m5mols_probe(struct i2c_client *client,
ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies), supplies);
if (ret) {
dev_err(&client->dev, "Failed to get regulators: %d\n", ret);
- goto out_gpio;
+ return ret;
}
sd = &info->sd;
@@ -1013,22 +1014,18 @@ out_me:
media_entity_cleanup(&sd->entity);
out_reg:
regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
-out_gpio:
- gpio_free(pdata->gpio_reset);
return ret;
}
static int m5mols_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
- struct m5mols_info *info = to_m5mols(sd);
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
free_irq(client->irq, sd);
regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
- gpio_free(info->pdata->gpio_reset);
media_entity_cleanup(&sd->entity);
return 0;
OpenPOWER on IntegriCloud