summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 08:29:43 -0300
committerChanho Park <chanho61.park@samsung.com>2014-03-20 17:35:15 +0900
commit54438c9d368d4d27d28e9e20640d2a88c09968a5 (patch)
treee1d2addf812a1037d53716ce62b3a66121ae903b /drivers/media
parentb425bc4de041fe8f788790074ac1551d0958b70e (diff)
downloadlinux-3.10-54438c9d368d4d27d28e9e20640d2a88c09968a5.tar.gz
linux-3.10-54438c9d368d4d27d28e9e20640d2a88c09968a5.tar.bz2
linux-3.10-54438c9d368d4d27d28e9e20640d2a88c09968a5.zip
[media] media: i2c: Convert to devm_regulator_bulk_get()
Using the managed function the regulator_bulk_put() 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')
-rw-r--r--drivers/media/i2c/m5mols/m5mols_core.c8
-rw-r--r--drivers/media/i2c/noon010pc30.c8
2 files changed, 5 insertions, 11 deletions
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index c69e98baf22..ff15e33cb33 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -987,7 +987,8 @@ static int m5mols_probe(struct i2c_client *client,
return ret;
}
- ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies), supplies);
+ ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies),
+ supplies);
if (ret) {
dev_err(&client->dev, "Failed to get regulators: %d\n", ret);
return ret;
@@ -1002,7 +1003,7 @@ static int m5mols_probe(struct i2c_client *client,
info->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_init(&sd->entity, 1, &info->pad, 0);
if (ret < 0)
- goto out_reg;
+ return ret;
sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
init_waitqueue_head(&info->irq_waitq);
@@ -1033,8 +1034,6 @@ out_irq:
free_irq(client->irq, sd);
out_me:
media_entity_cleanup(&sd->entity);
-out_reg:
- regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
return ret;
}
@@ -1046,7 +1045,6 @@ static int m5mols_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(sd->ctrl_handler);
free_irq(client->irq, sd);
- regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
media_entity_cleanup(&sd->entity);
return 0;
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index 6f81b99ddd1..2284b02102d 100644
--- a/drivers/media/i2c/noon010pc30.c
+++ b/drivers/media/i2c/noon010pc30.c
@@ -772,7 +772,7 @@ static int noon010_probe(struct i2c_client *client,
for (i = 0; i < NOON010_NUM_SUPPLIES; i++)
info->supply[i].supply = noon010_supply_name[i];
- ret = regulator_bulk_get(&client->dev, NOON010_NUM_SUPPLIES,
+ ret = devm_regulator_bulk_get(&client->dev, NOON010_NUM_SUPPLIES,
info->supply);
if (ret)
goto np_err;
@@ -781,14 +781,12 @@ static int noon010_probe(struct i2c_client *client,
sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &info->pad, 0);
if (ret < 0)
- goto np_me_err;
+ goto np_err;
ret = noon010_detect(client, info);
if (!ret)
return 0;
-np_me_err:
- regulator_bulk_free(NOON010_NUM_SUPPLIES, info->supply);
np_err:
v4l2_ctrl_handler_free(&info->hdl);
v4l2_device_unregister_subdev(sd);
@@ -802,8 +800,6 @@ static int noon010_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&info->hdl);
-
- regulator_bulk_free(NOON010_NUM_SUPPLIES, info->supply);
media_entity_cleanup(&sd->entity);
return 0;