[PATCH v3 3/3] phy: core: Warn when phy_power_on is called before phy_init
Jules Maselbas
jmaselbas at kalray.eu
Wed Apr 6 08:50:19 PDT 2022
A warning when the order of phy operation is mixed up by drivers,
this is an atempt to make the phy usage more uniform across (usb)
drivers.
Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
Cc: Ahmad Fatoum <a.fatoum at pengutronix.de>
Cc: Amelie DELAUNAY <amelie.delaunay at foss.st.com>
Cc: Minas Harutyunyan <hminas at synopsys.com>
Cc: Kishon Vijay Abraham I <kishon at ti.com>
---
drivers/phy/phy-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index d11b517e283a..90f589563a60 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -253,6 +253,9 @@ int phy_init(struct phy *phy)
ret = 0; /* Override possible ret == -ENOTSUPP */
mutex_lock(&phy->mutex);
+ if (phy->power_count > phy->init_count)
+ dev_warn(&phy->dev, "phy_power_on was called before phy_init\n");
+
if (phy->init_count == 0 && phy->ops->init) {
ret = phy->ops->init(phy);
if (ret < 0) {
--
2.17.1
More information about the linux-phy
mailing list