Commit 58b59e0f authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Wolfram Sang

i2c: pca954x: improve usage of gpiod API

Since 39b2bbe3 (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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent fef220da
...@@ -204,9 +204,9 @@ static int pca954x_probe(struct i2c_client *client, ...@@ -204,9 +204,9 @@ static int pca954x_probe(struct i2c_client *client,
i2c_set_clientdata(client, data); i2c_set_clientdata(client, data);
/* Get the mux out of reset if a reset GPIO is specified. */ /* Get the mux out of reset if a reset GPIO is specified. */
gpio = devm_gpiod_get(&client->dev, "reset"); gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
if (!IS_ERR(gpio)) if (IS_ERR(gpio))
gpiod_direction_output(gpio, 0); return PTR_ERR(gpio);
/* Write the mux register at addr to verify /* Write the mux register at addr to verify
* that the mux is in fact present. This also * that the mux is in fact present. This also
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment