diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2013-04-18 07:55:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-25 08:35:23 -0400 |
commit | b2afa23669ffb30173c010ccab1f6d1d4d0c82fb (patch) | |
tree | b206d6ae2070ab8950bfcd2e4956d53f3aab6181 /drivers/media/platform | |
parent | 5a66561f426d4a10bce077ba90ab127e6a27ac3d (diff) |
[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: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-is-sensor.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-is-sensor.c b/drivers/media/platform/exynos4-is/fimc-is-sensor.c index 6b3ea54269dd..035fa147de7f 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-sensor.c +++ b/drivers/media/platform/exynos4-is/fimc-is-sensor.c | |||
@@ -216,7 +216,8 @@ static int fimc_is_sensor_probe(struct i2c_client *client, | |||
216 | 216 | ||
217 | gpio = of_get_gpio_flags(dev->of_node, 0, NULL); | 217 | gpio = of_get_gpio_flags(dev->of_node, 0, NULL); |
218 | if (gpio_is_valid(gpio)) { | 218 | if (gpio_is_valid(gpio)) { |
219 | ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, DRIVER_NAME); | 219 | ret = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_LOW, |
220 | DRIVER_NAME); | ||
220 | if (ret < 0) | 221 | if (ret < 0) |
221 | return ret; | 222 | return ret; |
222 | } | 223 | } |
@@ -228,13 +229,11 @@ static int fimc_is_sensor_probe(struct i2c_client *client, | |||
228 | ret = devm_regulator_bulk_get(&client->dev, SENSOR_NUM_SUPPLIES, | 229 | ret = devm_regulator_bulk_get(&client->dev, SENSOR_NUM_SUPPLIES, |
229 | sensor->supplies); | 230 | sensor->supplies); |
230 | if (ret < 0) | 231 | if (ret < 0) |
231 | goto err_gpio; | 232 | return ret; |
232 | 233 | ||
233 | of_id = of_match_node(fimc_is_sensor_of_match, dev->of_node); | 234 | of_id = of_match_node(fimc_is_sensor_of_match, dev->of_node); |
234 | if (!of_id) { | 235 | if (!of_id) |
235 | ret = -ENODEV; | 236 | return -ENODEV; |
236 | goto err_reg; | ||
237 | } | ||
238 | 237 | ||
239 | sensor->drvdata = of_id->data; | 238 | sensor->drvdata = of_id->data; |
240 | sensor->dev = dev; | 239 | sensor->dev = dev; |
@@ -251,28 +250,19 @@ static int fimc_is_sensor_probe(struct i2c_client *client, | |||
251 | sensor->pad.flags = MEDIA_PAD_FL_SOURCE; | 250 | sensor->pad.flags = MEDIA_PAD_FL_SOURCE; |
252 | ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0); | 251 | ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0); |
253 | if (ret < 0) | 252 | if (ret < 0) |
254 | goto err_reg; | 253 | return ret; |
255 | 254 | ||
256 | v4l2_set_subdevdata(sd, sensor); | 255 | v4l2_set_subdevdata(sd, sensor); |
257 | pm_runtime_no_callbacks(dev); | 256 | pm_runtime_no_callbacks(dev); |
258 | pm_runtime_enable(dev); | 257 | pm_runtime_enable(dev); |
259 | 258 | ||
260 | return 0; | ||
261 | err_reg: | ||
262 | regulator_bulk_free(SENSOR_NUM_SUPPLIES, sensor->supplies); | ||
263 | err_gpio: | ||
264 | if (gpio_is_valid(sensor->gpio_reset)) | ||
265 | gpio_free(sensor->gpio_reset); | ||
266 | return ret; | 259 | return ret; |
267 | } | 260 | } |
268 | 261 | ||
269 | static int fimc_is_sensor_remove(struct i2c_client *client) | 262 | static int fimc_is_sensor_remove(struct i2c_client *client) |
270 | { | 263 | { |
271 | struct fimc_is_sensor *sensor; | 264 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
272 | 265 | media_entity_cleanup(&sd->entity); | |
273 | regulator_bulk_free(SENSOR_NUM_SUPPLIES, sensor->supplies); | ||
274 | media_entity_cleanup(&sensor->subdev.entity); | ||
275 | |||
276 | return 0; | 266 | return 0; |
277 | } | 267 | } |
278 | 268 | ||