gpio: pisosr: Use devm_gpiod_get_optional for gpio->load_gpio
authorAxel Lin <axel.lin@ingics.com>
Mon, 22 Feb 2016 12:16:51 +0000 (20:16 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 25 Feb 2016 14:20:46 +0000 (15:20 +0100)
gpio->load_gpio is optional, so use devm_gpiod_get_optional instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-pisosr.c

index f9f1074744ab21bc23565ea49bfaca29d0486ab9..8b8bf8f9de6a4f135b5385b2456ce3bb528db097 100644 (file)
@@ -125,15 +125,12 @@ static int pisosr_gpio_probe(struct spi_device *spi)
        if (!gpio->buffer)
                return -ENOMEM;
 
-       gpio->load_gpio = devm_gpiod_get(dev, "load", GPIOD_OUT_LOW);
+       gpio->load_gpio = devm_gpiod_get_optional(dev, "load", GPIOD_OUT_LOW);
        if (IS_ERR(gpio->load_gpio)) {
                ret = PTR_ERR(gpio->load_gpio);
-               if (ret != -ENOENT && ret != -ENOSYS) {
-                       if (ret != -EPROBE_DEFER)
-                               dev_err(dev, "Unable to allocate load GPIO\n");
-                       return ret;
-               }
-               gpio->load_gpio = NULL;
+               if (ret != -EPROBE_DEFER)
+                       dev_err(dev, "Unable to allocate load GPIO\n");
+               return ret;
        }
 
        mutex_init(&gpio->lock);