summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/muxes
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2015-02-17 10:12:08 +0100
committerWolfram Sang <wsa@the-dreams.de>2015-03-09 10:51:59 +0100
commit58b59e0f2462780ae3978611519f6a5e477e31df (patch)
tree1a623a8a9cbbc0406f6fc4db39a52a055f9ae769 /drivers/i2c/muxes
parentfef220da43d8537ed7d11da4db17b958cd779887 (diff)
downloadlinux-58b59e0f2462780ae3978611519f6a5e477e31df.tar.bz2
i2c: pca954x: improve usage of gpiod API
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions) which appeared in v3.17-rc1, the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for outputs. Also there is an *_optional variant that serves well here. The sematics is slightly changed here by using it. Now if a reset gpio is specified and getting hold on it fails, pca954x_probe fails, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/muxes')
-rw-r--r--drivers/i2c/muxes/i2c-mux-pca954x.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 3d8f4fe2e47e..bea0d2de2993 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -204,9 +204,9 @@ static int pca954x_probe(struct i2c_client *client,
i2c_set_clientdata(client, data);
/* Get the mux out of reset if a reset GPIO is specified. */
- gpio = devm_gpiod_get(&client->dev, "reset");
- if (!IS_ERR(gpio))
- gpiod_direction_output(gpio, 0);
+ gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(gpio))
+ return PTR_ERR(gpio);
/* Write the mux register at addr to verify
* that the mux is in fact present. This also