Skip to content

Commit

Permalink
phy: core: Warn when phy_power_on is called before phy_init
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Ahmad Fatoum <[email protected]>
Cc: Amelie DELAUNAY <[email protected]>
Cc: Minas Harutyunyan <[email protected]>
Cc: Kishon Vijay Abraham I <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
jmaselbas authored and vinodkoul committed Apr 20, 2022
1 parent bd5bd02 commit 1599069
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/phy/phy-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1599069

Please sign in to comment.