Re: [PATCH v17 3/5] phy: core: Add devm_phy_get_by_of_node()

From: Manivannan Sadhasivam

Date: Thu Sep 17 2026 - 01:06:15 EST


On Sun, Sep 06, 2026 at 03:17:07PM +0100, Bryan O'Donoghue wrote:
> Add a devm variant of phy_get_by_of_node() to allow for the familiar
> pattern of having devres automatically release resources on the driver's
> exit path.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> ---
> drivers/phy/phy-core.c | 34 ++++++++++++++++++++++++++++++++++
> include/linux/phy/phy.h | 7 +++++++
> 2 files changed, 41 insertions(+)
>
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 490a7cde6d40a..2e3581ecb42ee 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -1050,6 +1050,40 @@ struct phy *phy_get_by_of_node(struct device_node *np)
> }
> EXPORT_SYMBOL_GPL(phy_get_by_of_node);
>
> +/**
> + * devm_phy_get_by_of_node() - devm managed lookup and obtain phy reference by device node
> + * @dev: device requesting the PHY
> + * @np: device_node of the PHY provider
> + *
> + * Returns phy associated with the device_node or ERR_PTR. devres manages

'Returns:'

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>

- Mani

--
மணிவண்ணன் சதாசிவம்