diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-02-18 07:47:11 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-02-22 04:49:22 -0500 |
commit | b457f53a2afa7de3cecdec1772fbd522b98afc49 (patch) | |
tree | 28998a43fc28d1a630f3dd24d3618a7a4741929b /drivers/iio/gyro/bmg160.c | |
parent | 1a179a14d152467da7038205af52883f38973afe (diff) |
iio: 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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro/bmg160.c')
-rw-r--r-- | drivers/iio/gyro/bmg160.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c index 60451b328242..56d68e1d0987 100644 --- a/drivers/iio/gyro/bmg160.c +++ b/drivers/iio/gyro/bmg160.c | |||
@@ -1001,16 +1001,12 @@ static int bmg160_gpio_probe(struct i2c_client *client, | |||
1001 | dev = &client->dev; | 1001 | dev = &client->dev; |
1002 | 1002 | ||
1003 | /* data ready gpio interrupt pin */ | 1003 | /* data ready gpio interrupt pin */ |
1004 | gpio = devm_gpiod_get_index(dev, BMG160_GPIO_NAME, 0); | 1004 | gpio = devm_gpiod_get_index(dev, BMG160_GPIO_NAME, 0, GPIOD_IN); |
1005 | if (IS_ERR(gpio)) { | 1005 | if (IS_ERR(gpio)) { |
1006 | dev_err(dev, "acpi gpio get index failed\n"); | 1006 | dev_err(dev, "acpi gpio get index failed\n"); |
1007 | return PTR_ERR(gpio); | 1007 | return PTR_ERR(gpio); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | ret = gpiod_direction_input(gpio); | ||
1011 | if (ret) | ||
1012 | return ret; | ||
1013 | |||
1014 | ret = gpiod_to_irq(gpio); | 1010 | ret = gpiod_to_irq(gpio); |
1015 | 1011 | ||
1016 | dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret); | 1012 | dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret); |