Commit b2afa236 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] exynos4-is: Fix regulator/gpio resource releasing on the driver removal

Remove regulator_bulk_free() calls as devm_regulator_bulk_get() function
is used to get the regulators so those will be freed automatically while
the driver is removed.
Missing gpio free is fixed by requesting a gpio with the devm_* API.
All that is done now in the I2C client driver remove() callback is the
media entity cleanup call.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5a66561f
...@@ -216,7 +216,8 @@ static int fimc_is_sensor_probe(struct i2c_client *client, ...@@ -216,7 +216,8 @@ static int fimc_is_sensor_probe(struct i2c_client *client,
gpio = of_get_gpio_flags(dev->of_node, 0, NULL); gpio = of_get_gpio_flags(dev->of_node, 0, NULL);
if (gpio_is_valid(gpio)) { if (gpio_is_valid(gpio)) {
ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, DRIVER_NAME); ret = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_LOW,
DRIVER_NAME);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
...@@ -228,13 +229,11 @@ static int fimc_is_sensor_probe(struct i2c_client *client, ...@@ -228,13 +229,11 @@ static int fimc_is_sensor_probe(struct i2c_client *client,
ret = devm_regulator_bulk_get(&client->dev, SENSOR_NUM_SUPPLIES, ret = devm_regulator_bulk_get(&client->dev, SENSOR_NUM_SUPPLIES,
sensor->supplies); sensor->supplies);
if (ret < 0) if (ret < 0)
goto err_gpio; return ret;
of_id = of_match_node(fimc_is_sensor_of_match, dev->of_node); of_id = of_match_node(fimc_is_sensor_of_match, dev->of_node);
if (!of_id) { if (!of_id)
ret = -ENODEV; return -ENODEV;
goto err_reg;
}
sensor->drvdata = of_id->data; sensor->drvdata = of_id->data;
sensor->dev = dev; sensor->dev = dev;
...@@ -251,28 +250,19 @@ static int fimc_is_sensor_probe(struct i2c_client *client, ...@@ -251,28 +250,19 @@ static int fimc_is_sensor_probe(struct i2c_client *client,
sensor->pad.flags = MEDIA_PAD_FL_SOURCE; sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0); ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0);
if (ret < 0) if (ret < 0)
goto err_reg; return ret;
v4l2_set_subdevdata(sd, sensor); v4l2_set_subdevdata(sd, sensor);
pm_runtime_no_callbacks(dev); pm_runtime_no_callbacks(dev);
pm_runtime_enable(dev); pm_runtime_enable(dev);
return 0;
err_reg:
regulator_bulk_free(SENSOR_NUM_SUPPLIES, sensor->supplies);
err_gpio:
if (gpio_is_valid(sensor->gpio_reset))
gpio_free(sensor->gpio_reset);
return ret; return ret;
} }
static int fimc_is_sensor_remove(struct i2c_client *client) static int fimc_is_sensor_remove(struct i2c_client *client)
{ {
struct fimc_is_sensor *sensor; struct v4l2_subdev *sd = i2c_get_clientdata(client);
media_entity_cleanup(&sd->entity);
regulator_bulk_free(SENSOR_NUM_SUPPLIES, sensor->supplies);
media_entity_cleanup(&sensor->subdev.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