aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-09-24 20:47:29 -0400
committerKishon Vijay Abraham I <kishon@ti.com>2015-10-06 10:51:47 -0400
commitb2dfc34c975ad7b9c531f8b93f8bd7b8606286c1 (patch)
tree9df28ae62a3e1b0ef1d7d51ede642d05c4c19192
parentdc7f190fd51f5c64d7d9280e5f052b46ce8cee24 (diff)
phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOs
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>
-rw-r--r--drivers/phy/phy-sun4i-usb.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index 731b395d6e6a..b12964b70625 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -551,19 +551,15 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
551 if (IS_ERR(data->base)) 551 if (IS_ERR(data->base))
552 return PTR_ERR(data->base); 552 return PTR_ERR(data->base);
553 553
554 data->id_det_gpio = devm_gpiod_get(dev, "usb0_id_det", GPIOD_IN); 554 data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det",
555 if (IS_ERR(data->id_det_gpio)) { 555 GPIOD_IN);
556 if (PTR_ERR(data->id_det_gpio) == -EPROBE_DEFER) 556 if (IS_ERR(data->id_det_gpio))
557 return -EPROBE_DEFER; 557 return PTR_ERR(data->id_det_gpio);
558 data->id_det_gpio = NULL; 558
559 } 559 data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det",
560 560 GPIOD_IN);
561 data->vbus_det_gpio = devm_gpiod_get(dev, "usb0_vbus_det", GPIOD_IN); 561 if (IS_ERR(data->vbus_det_gpio))
562 if (IS_ERR(data->vbus_det_gpio)) { 562 return PTR_ERR(data->vbus_det_gpio);
563 if (PTR_ERR(data->vbus_det_gpio) == -EPROBE_DEFER)
564 return -EPROBE_DEFER;
565 data->vbus_det_gpio = NULL;
566 }
567 563
568 if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { 564 if (of_find_property(np, "usb0_vbus_power-supply", NULL)) {
569 data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, 565 data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,