diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2023-01-24 19:37:22 +0100 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2023-02-03 10:52:49 +0530 |
commit | d02aa181ee595c81738b6bd7ebad6025fbee035a (patch) | |
tree | 6b3631822392d9685727c3bd19eeed3d406a8159 /Documentation/driver-api | |
parent | 59c3d3d00d60b6d75ef3faf3b24e6aac037c1085 (diff) |
phy: Add devm_of_phy_optional_get() helper
Add an optional variant of devm_of_phy_get() that also takes care of
printing real errors, so drivers no longer have to open-code this
operation.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/4cd0069bcff424ffc5c3a102397c02370b91985b.1674584626.git.geert+renesas@glider.be
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'Documentation/driver-api')
-rw-r--r-- | Documentation/driver-api/phy/phy.rst | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Documentation/driver-api/phy/phy.rst b/Documentation/driver-api/phy/phy.rst index 6cadc58f4ce0..81785c084f3e 100644 --- a/Documentation/driver-api/phy/phy.rst +++ b/Documentation/driver-api/phy/phy.rst @@ -108,6 +108,9 @@ it. This framework provides the following APIs to get a reference to the PHY. const char *string); struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, const char *con_id); + struct phy *devm_of_phy_optional_get(struct device *dev, + struct device_node *np, + const char *con_id); struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, int index); @@ -119,8 +122,8 @@ non-dt boot, it should contain the label of the PHY. The two devm_phy_get associates the device with the PHY using devres on successful PHY get. On driver detach, release function is invoked on the devres data and devres data is freed. -devm_phy_optional_get should be used when the phy is optional. This -function will never return -ENODEV, but instead returns NULL when +The _optional_get variants should be used when the phy is optional. These +functions will never return -ENODEV, but instead return NULL when the phy cannot be found. Some generic drivers, such as ehci, may use multiple phys. In this case, devm_of_phy_get or devm_of_phy_get_by_index can be used to get a phy |