History

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.

Kishon Vijay Abraham I committed 7 years ago

Commit fec06b21 parent 42c7cb72 files · +7 −0Browse files

Unified · Split

2 files
  1. drivers/phy/phy-core.c +5 −0
  2. include/linux/phy/phy.h +2 −0
drivers/phy/phy-core.c+5−0
@@ -564,6 +564,11 @@ void phy_put(struct phy *phy) · 563 unmodified lines
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+2−0
@@ -64,6 +64,7 @@ union phy_configure_opts { · 63 unmodified lines
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 { · 35 unmodified lines
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