iio: improve usage of gpiod API
[firefly-linux-kernel-4.4.55.git] / drivers / iio / proximity / sx9500.c
index 74dff4e4a11acdda1ec44ec6eaec75ef4d0543e4..0b4d79490b05a7954bf64586bb6a12a3d14e8749 100644 (file)
@@ -618,16 +618,12 @@ static int sx9500_gpio_probe(struct i2c_client *client,
        dev = &client->dev;
 
        /* data ready gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0);
+       gpio = devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);
        if (IS_ERR(gpio)) {
                dev_err(dev, "acpi gpio get index failed\n");
                return PTR_ERR(gpio);
        }
 
-       ret = gpiod_direction_input(gpio);
-       if (ret)
-               return ret;
-
        ret = gpiod_to_irq(gpio);
 
        dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);