diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-05-02 07:29:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-05-21 06:53:18 -0400 |
commit | b015ba29ca09b0e3750b4de365d3baf9c5b11450 (patch) | |
tree | bc512024bb642bc2058473c6f73fb45b7a5712c0 /drivers/media/i2c/smiapp | |
parent | c02b211df6fc54e51ee554c27a6736a11255a764 (diff) |
[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/smiapp')
-rw-r--r-- | drivers/media/i2c/smiapp/smiapp-core.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index cae4f4683851..c38545419045 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
@@ -2383,8 +2383,9 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN) { | 2385 | if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN) { |
2386 | if (gpio_request_one(sensor->platform_data->xshutdown, 0, | 2386 | if (devm_gpio_request_one(&client->dev, |
2387 | "SMIA++ xshutdown") != 0) { | 2387 | sensor->platform_data->xshutdown, 0, |
2388 | "SMIA++ xshutdown") != 0) { | ||
2388 | dev_err(&client->dev, | 2389 | dev_err(&client->dev, |
2389 | "unable to acquire reset gpio %d\n", | 2390 | "unable to acquire reset gpio %d\n", |
2390 | sensor->platform_data->xshutdown); | 2391 | sensor->platform_data->xshutdown); |
@@ -2393,10 +2394,8 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
2393 | } | 2394 | } |
2394 | 2395 | ||
2395 | rval = smiapp_power_on(sensor); | 2396 | rval = smiapp_power_on(sensor); |
2396 | if (rval) { | 2397 | if (rval) |
2397 | rval = -ENODEV; | 2398 | return -ENODEV; |
2398 | goto out_smiapp_power_on; | ||
2399 | } | ||
2400 | 2399 | ||
2401 | rval = smiapp_identify_module(subdev); | 2400 | rval = smiapp_identify_module(subdev); |
2402 | if (rval) { | 2401 | if (rval) { |
@@ -2656,11 +2655,6 @@ out_ident_release: | |||
2656 | 2655 | ||
2657 | out_power_off: | 2656 | out_power_off: |
2658 | smiapp_power_off(sensor); | 2657 | smiapp_power_off(sensor); |
2659 | |||
2660 | out_smiapp_power_on: | ||
2661 | if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN) | ||
2662 | gpio_free(sensor->platform_data->xshutdown); | ||
2663 | |||
2664 | return rval; | 2658 | return rval; |
2665 | } | 2659 | } |
2666 | 2660 | ||
@@ -2858,8 +2852,6 @@ static int smiapp_remove(struct i2c_client *client) | |||
2858 | v4l2_device_unregister_subdev(&sensor->ssds[i].sd); | 2852 | v4l2_device_unregister_subdev(&sensor->ssds[i].sd); |
2859 | } | 2853 | } |
2860 | smiapp_free_controls(sensor); | 2854 | smiapp_free_controls(sensor); |
2861 | if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN) | ||
2862 | gpio_free(sensor->platform_data->xshutdown); | ||
2863 | 2855 | ||
2864 | return 0; | 2856 | return 0; |
2865 | } | 2857 | } |