phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs
authorAxel Lin <axel.lin@ingics.com>
Fri, 25 Sep 2015 00:47:29 +0000 (08:47 +0800)
committerKishon Vijay Abraham I <kishon@ti.com>
Tue, 6 Oct 2015 14:51:47 +0000 (20:21 +0530)
Both data->id_det_gpio and data->vbus_det_gpio are optional, so use
devm_gpiod_get_optional for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/phy-sun4i-usb.c

index 731b395d6e6a1621ee7fc36055b6c1a5f7367780..b12964b70625f6753997a1f529fb4c5f4c96b4d3 100644 (file)
@@ -551,19 +551,15 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
        if (IS_ERR(data->base))
                return PTR_ERR(data->base);
 
-       data->id_det_gpio = devm_gpiod_get(dev, "usb0_id_det", GPIOD_IN);
-       if (IS_ERR(data->id_det_gpio)) {
-               if (PTR_ERR(data->id_det_gpio) == -EPROBE_DEFER)
-                       return -EPROBE_DEFER;
-               data->id_det_gpio = NULL;
-       }
-
-       data->vbus_det_gpio = devm_gpiod_get(dev, "usb0_vbus_det", GPIOD_IN);
-       if (IS_ERR(data->vbus_det_gpio)) {
-               if (PTR_ERR(data->vbus_det_gpio) == -EPROBE_DEFER)
-                       return -EPROBE_DEFER;
-               data->vbus_det_gpio = NULL;
-       }
+       data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det",
+                                                   GPIOD_IN);
+       if (IS_ERR(data->id_det_gpio))
+               return PTR_ERR(data->id_det_gpio);
+
+       data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det",
+                                                     GPIOD_IN);
+       if (IS_ERR(data->vbus_det_gpio))
+               return PTR_ERR(data->vbus_det_gpio);
 
        if (of_find_property(np, "usb0_vbus_power-supply", NULL)) {
                data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,