* [PATCH] usb: phy: generic: make vcc regulator optional
@ 2022-10-12 13:27 Sascha Hauer
2023-01-12 17:25 ` Ahmad Fatoum
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2022-10-12 13:27 UTC (permalink / raw)
To: linux-usb; +Cc: linux-kernel, Felipe Balbi, kernel, Mark Brown, Sascha Hauer
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: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/phy/phy-generic.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 34b9f81401871..92d3e067067c6 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -209,7 +209,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
int err = 0;
u32 clk_rate = 0;
- bool needs_vcc = false, needs_clk = false;
+ bool needs_clk = false;
if (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)
if (of_property_read_u32(node, "clock-frequency", &clk_rate))
clk_rate = 0;
- needs_vcc = of_property_read_bool(node, "vcc-supply");
needs_clk = of_property_read_bool(node, "clocks");
}
nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
@@ -260,13 +259,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
}
}
- nop->vcc = devm_regulator_get(dev, "vcc");
- if (IS_ERR(nop->vcc)) {
- dev_dbg(dev, "Error getting vcc regulator: %ld\n",
- PTR_ERR(nop->vcc));
- if (needs_vcc)
- return -EPROBE_DEFER;
- }
+ nop->vcc = devm_regulator_get_optional(dev, "vcc");
+ if (IS_ERR(nop->vcc) && PTR_ERR(nop->vcc) != -ENODEV)
+ return dev_err_probe(dev, PTR_ERR(nop->vcc),
+ "could not get vcc regulator\n");
nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
if (PTR_ERR(nop->vbus_draw) == -ENODEV)
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: phy: generic: make vcc regulator optional
2022-10-12 13:27 [PATCH] usb: phy: generic: make vcc regulator optional Sascha Hauer
@ 2023-01-12 17:25 ` Ahmad Fatoum
0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2023-01-12 17:25 UTC (permalink / raw)
To: Sascha Hauer, linux-usb; +Cc: Felipe Balbi, Mark Brown, linux-kernel, kernel
On 12.10.22 15:27, Sascha Hauer wrote:
> 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.
Gentle ping.
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/usb/phy/phy-generic.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> index 34b9f81401871..92d3e067067c6 100644
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -209,7 +209,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
> int err = 0;
>
> u32 clk_rate = 0;
> - bool needs_vcc = false, needs_clk = false;
> + bool needs_clk = false;
>
> if (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)
> if (of_property_read_u32(node, "clock-frequency", &clk_rate))
> clk_rate = 0;
>
> - needs_vcc = of_property_read_bool(node, "vcc-supply");
> needs_clk = of_property_read_bool(node, "clocks");
> }
> nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
> @@ -260,13 +259,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
> }
> }
>
> - nop->vcc = devm_regulator_get(dev, "vcc");
> - if (IS_ERR(nop->vcc)) {
> - dev_dbg(dev, "Error getting vcc regulator: %ld\n",
> - PTR_ERR(nop->vcc));
> - if (needs_vcc)
> - return -EPROBE_DEFER;
> - }
> + nop->vcc = devm_regulator_get_optional(dev, "vcc");
> + if (IS_ERR(nop->vcc) && PTR_ERR(nop->vcc) != -ENODEV)
> + return dev_err_probe(dev, PTR_ERR(nop->vcc),
> + "could not get vcc regulator\n");
>
> nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
> if (PTR_ERR(nop->vbus_draw) == -ENODEV)
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-12 18:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 13:27 [PATCH] usb: phy: generic: make vcc regulator optional Sascha Hauer
2023-01-12 17:25 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).