Commit 07e0e5b2 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b015ba29
...@@ -966,7 +966,8 @@ static int m5mols_probe(struct i2c_client *client, ...@@ -966,7 +966,8 @@ static int m5mols_probe(struct i2c_client *client,
return ret; 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) { if (ret) {
dev_err(&client->dev, "Failed to get regulators: %d\n", ret); dev_err(&client->dev, "Failed to get regulators: %d\n", ret);
return ret; return ret;
...@@ -981,7 +982,7 @@ static int m5mols_probe(struct i2c_client *client, ...@@ -981,7 +982,7 @@ static int m5mols_probe(struct i2c_client *client,
info->pad.flags = MEDIA_PAD_FL_SOURCE; info->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_init(&sd->entity, 1, &info->pad, 0); ret = media_entity_init(&sd->entity, 1, &info->pad, 0);
if (ret < 0) if (ret < 0)
goto out_reg; return ret;
sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
init_waitqueue_head(&info->irq_waitq); init_waitqueue_head(&info->irq_waitq);
...@@ -1012,8 +1013,6 @@ static int m5mols_probe(struct i2c_client *client, ...@@ -1012,8 +1013,6 @@ static int m5mols_probe(struct i2c_client *client,
free_irq(client->irq, sd); free_irq(client->irq, sd);
out_me: out_me:
media_entity_cleanup(&sd->entity); media_entity_cleanup(&sd->entity);
out_reg:
regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
return ret; return ret;
} }
...@@ -1025,7 +1024,6 @@ static int m5mols_remove(struct i2c_client *client) ...@@ -1025,7 +1024,6 @@ static int m5mols_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(sd->ctrl_handler); v4l2_ctrl_handler_free(sd->ctrl_handler);
free_irq(client->irq, sd); free_irq(client->irq, sd);
regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
media_entity_cleanup(&sd->entity); media_entity_cleanup(&sd->entity);
return 0; return 0;
......
...@@ -772,7 +772,7 @@ static int noon010_probe(struct i2c_client *client, ...@@ -772,7 +772,7 @@ static int noon010_probe(struct i2c_client *client,
for (i = 0; i < NOON010_NUM_SUPPLIES; i++) for (i = 0; i < NOON010_NUM_SUPPLIES; i++)
info->supply[i].supply = noon010_supply_name[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); info->supply);
if (ret) if (ret)
goto np_err; goto np_err;
...@@ -781,14 +781,12 @@ static int noon010_probe(struct i2c_client *client, ...@@ -781,14 +781,12 @@ static int noon010_probe(struct i2c_client *client,
sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &info->pad, 0); ret = media_entity_init(&sd->entity, 1, &info->pad, 0);
if (ret < 0) if (ret < 0)
goto np_me_err; goto np_err;
ret = noon010_detect(client, info); ret = noon010_detect(client, info);
if (!ret) if (!ret)
return 0; return 0;
np_me_err:
regulator_bulk_free(NOON010_NUM_SUPPLIES, info->supply);
np_err: np_err:
v4l2_ctrl_handler_free(&info->hdl); v4l2_ctrl_handler_free(&info->hdl);
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
...@@ -802,8 +800,6 @@ static int noon010_remove(struct i2c_client *client) ...@@ -802,8 +800,6 @@ static int noon010_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&info->hdl); v4l2_ctrl_handler_free(&info->hdl);
regulator_bulk_free(NOON010_NUM_SUPPLIES, info->supply);
media_entity_cleanup(&sd->entity); media_entity_cleanup(&sd->entity);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment