[PATCH v2 3/3] phy: core: Warn when phy_power_on is called before phy_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Cc: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
Cc: Amelie DELAUNAY <amelie.delaunay@xxxxxxxxxxx>
Cc: Minas Harutyunyan <hminas@xxxxxxxxxxxx>
Cc: Kishon Vijay Abraham I <kishon@xxxxxx>
---
change in v2:
  - no changes

 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 cbdad65d2caa..0cb4da62577e 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -252,6 +252,9 @@ int phy_init(struct phy *phy)
 		return ret;
 	ret = 0; /* Override possible ret == -ENOTSUPP */
 
+	if (phy->power_count > phy->init_count)
+		dev_warn(&phy->dev, "phy_power_on was called before phy_init\n");
+
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 0 && phy->ops->init) {
 		ret = phy->ops->init(phy);
-- 
2.17.1




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux