Skip to content

Commit fec06b2

Browse files
committed
phy: core: Add *release* phy_ops invoked when the consumer relinquishes PHY
Add a new phy_ops *release* invoked when the consumer relinquishes the PHY using phy_put/devm_phy_put. The initializations done by the PHY driver in of_xlate call back can be can be cleaned up here. Signed-off-by: Kishon Vijay Abraham I <[email protected]>
1 parent 42c7cb7 commit fec06b2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/phy/phy-core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@ void phy_put(struct phy *phy)
564564
if (!phy || IS_ERR(phy))
565565
return;
566566

567+
mutex_lock(&phy->mutex);
568+
if (phy->ops->release)
569+
phy->ops->release(phy);
570+
mutex_unlock(&phy->mutex);
571+
567572
module_put(phy->ops->owner);
568573
put_device(&phy->dev);
569574
}

include/linux/phy/phy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ union phy_configure_opts {
6464
* @set_mode: set the mode of the phy
6565
* @reset: resetting the phy
6666
* @calibrate: calibrate the phy
67+
* @release: ops to be performed while the consumer relinquishes the PHY
6768
* @owner: the module owner containing the ops
6869
*/
6970
struct phy_ops {
@@ -105,6 +106,7 @@ struct phy_ops {
105106
union phy_configure_opts *opts);
106107
int (*reset)(struct phy *phy);
107108
int (*calibrate)(struct phy *phy);
109+
void (*release)(struct phy *phy);
108110
struct module *owner;
109111
};
110112

0 commit comments

Comments
 (0)