aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/adv7183.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 07:29:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 06:53:18 -0400
commitb015ba29ca09b0e3750b4de365d3baf9c5b11450 (patch)
treebc512024bb642bc2058473c6f73fb45b7a5712c0 /drivers/media/i2c/adv7183.c
parentc02b211df6fc54e51ee554c27a6736a11255a764 (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/adv7183.c')
-rw-r--r--drivers/media/i2c/adv7183.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index 56904174abc3..42b2dec4ca3a 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -580,17 +580,17 @@ static int adv7183_probe(struct i2c_client *client,
580 decoder->reset_pin = pin_array[0]; 580 decoder->reset_pin = pin_array[0];
581 decoder->oe_pin = pin_array[1]; 581 decoder->oe_pin = pin_array[1];
582 582
583 if (gpio_request_one(decoder->reset_pin, GPIOF_OUT_INIT_LOW, 583 if (devm_gpio_request_one(&client->dev, decoder->reset_pin,
584 "ADV7183 Reset")) { 584 GPIOF_OUT_INIT_LOW, "ADV7183 Reset")) {
585 v4l_err(client, "failed to request GPIO %d\n", decoder->reset_pin); 585 v4l_err(client, "failed to request GPIO %d\n", decoder->reset_pin);
586 return -EBUSY; 586 return -EBUSY;
587 } 587 }
588 588
589 if (gpio_request_one(decoder->oe_pin, GPIOF_OUT_INIT_HIGH, 589 if (devm_gpio_request_one(&client->dev, decoder->oe_pin,
590 "ADV7183 Output Enable")) { 590 GPIOF_OUT_INIT_HIGH,
591 "ADV7183 Output Enable")) {
591 v4l_err(client, "failed to request GPIO %d\n", decoder->oe_pin); 592 v4l_err(client, "failed to request GPIO %d\n", decoder->oe_pin);
592 ret = -EBUSY; 593 return -EBUSY;
593 goto err_free_reset;
594 } 594 }
595 595
596 sd = &decoder->sd; 596 sd = &decoder->sd;
@@ -612,7 +612,7 @@ static int adv7183_probe(struct i2c_client *client,
612 ret = hdl->error; 612 ret = hdl->error;
613 613
614 v4l2_ctrl_handler_free(hdl); 614 v4l2_ctrl_handler_free(hdl);
615 goto err_free_oe; 615 return ret;
616 } 616 }
617 617
618 /* v4l2 doesn't support an autodetect standard, pick PAL as default */ 618 /* v4l2 doesn't support an autodetect standard, pick PAL as default */
@@ -637,26 +637,18 @@ static int adv7183_probe(struct i2c_client *client,
637 ret = v4l2_ctrl_handler_setup(hdl); 637 ret = v4l2_ctrl_handler_setup(hdl);
638 if (ret) { 638 if (ret) {
639 v4l2_ctrl_handler_free(hdl); 639 v4l2_ctrl_handler_free(hdl);
640 goto err_free_oe; 640 return ret;
641 } 641 }
642 642
643 return 0; 643 return 0;
644err_free_oe:
645 gpio_free(decoder->oe_pin);
646err_free_reset:
647 gpio_free(decoder->reset_pin);
648 return ret;
649} 644}
650 645
651static int adv7183_remove(struct i2c_client *client) 646static int adv7183_remove(struct i2c_client *client)
652{ 647{
653 struct v4l2_subdev *sd = i2c_get_clientdata(client); 648 struct v4l2_subdev *sd = i2c_get_clientdata(client);
654 struct adv7183 *decoder = to_adv7183(sd);
655 649
656 v4l2_device_unregister_subdev(sd); 650 v4l2_device_unregister_subdev(sd);
657 v4l2_ctrl_handler_free(sd->ctrl_handler); 651 v4l2_ctrl_handler_free(sd->ctrl_handler);
658 gpio_free(decoder->oe_pin);
659 gpio_free(decoder->reset_pin);
660 return 0; 652 return 0;
661} 653}
662 654