Commit 32c6fefb authored by Sascha Hauer's avatar Sascha Hauer Committed by Greg Kroah-Hartman

usb: phy: generic: make vcc regulator optional

phy-generic uses the existance of the property "vcc-supply" to see if a
regulator is optional or not. Use devm_regulator_get_optional() instead
which exists for this purpose. Using devm_regulator_get_optional()
avoids "supply vcc not found, using dummy regulator" messages.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20221012132754.292151-1-s.hauer@pengutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55f223b8
...@@ -209,7 +209,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) ...@@ -209,7 +209,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
int err = 0; int err = 0;
u32 clk_rate = 0; u32 clk_rate = 0;
bool needs_vcc = false, needs_clk = false; bool needs_clk = false;
if (dev->of_node) { if (dev->of_node) {
struct device_node *node = dev->of_node; struct device_node *node = dev->of_node;
...@@ -217,7 +217,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) ...@@ -217,7 +217,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
if (of_property_read_u32(node, "clock-frequency", &clk_rate)) if (of_property_read_u32(node, "clock-frequency", &clk_rate))
clk_rate = 0; clk_rate = 0;
needs_vcc = of_property_read_bool(node, "vcc-supply");
needs_clk = of_property_read_bool(node, "clocks"); needs_clk = of_property_read_bool(node, "clocks");
} }
nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
...@@ -257,13 +256,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) ...@@ -257,13 +256,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
} }
} }
nop->vcc = devm_regulator_get(dev, "vcc"); nop->vcc = devm_regulator_get_optional(dev, "vcc");
if (IS_ERR(nop->vcc)) { if (IS_ERR(nop->vcc) && PTR_ERR(nop->vcc) != -ENODEV)
dev_dbg(dev, "Error getting vcc regulator: %ld\n", return dev_err_probe(dev, PTR_ERR(nop->vcc),
PTR_ERR(nop->vcc)); "could not get vcc regulator\n");
if (needs_vcc)
return -EPROBE_DEFER;
}
nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
if (PTR_ERR(nop->vbus_draw) == -ENODEV) if (PTR_ERR(nop->vbus_draw) == -ENODEV)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment