[media] tc358743: make reset gpio optional
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 18 Aug 2015 08:31:10 +0000 (05:31 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 3 Sep 2015 16:18:23 +0000 (13:18 -0300)
Commit 256148246852 ("[media] tc358743: support probe from device tree")
specified in the device tree binding documentation that the reset gpio
is optional. Make the implementation match accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/tc358743.c

index a4efb6e2e7a2c0d0a6d613c585171106ee7f02c9..7a6fdecc7215beeda1ab3a9b17d56a09450888c1 100644 (file)
@@ -1782,14 +1782,16 @@ static int tc358743_probe_of(struct tc358743_state *state)
        state->pdata.ths_trailcnt = 0x2;
        state->pdata.hstxvregcnt = 0;
 
-       state->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+       state->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+                                                   GPIOD_OUT_LOW);
        if (IS_ERR(state->reset_gpio)) {
                dev_err(dev, "failed to get reset gpio\n");
                ret = PTR_ERR(state->reset_gpio);
                goto disable_clk;
        }
 
-       tc358743_gpio_reset(state);
+       if (state->reset_gpio)
+               tc358743_gpio_reset(state);
 
        ret = 0;
        goto free_endpoint;