[PATCH] phy: core: Make 'phy_optional_get' return NULL when not implemented

Sascha Hauer sha at pengutronix.de
Thu Mar 3 01:53:45 PST 2022


On Wed, Oct 20, 2021 at 10:39:54AM +0200, Daniel Brát wrote:
> Make 'phy_optional_get' return NULL instead of ERR_PTR(-ENOSYS) when the
> CONFIG_GENERIC_PHY is not enabled. It makes more sense to return NULL instead
> of straight up throwing a error since the function has 'optional' in its name.
> This also fixes dwc2 usb driver which would previously fail inside its probe
> function despite being able to function without a phy just fine.
> 
> Signed-off-by: Daniel Brát <danek.brat at gmail.com>
> ---
>  include/linux/phy/phy.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

After I have received a patch which lets the EHCI driver depend on
CONFIG_GENERIC_PHY which effectively disables the EHCI in a bunch of
defconfigs I finally deciced to take this patch as-is.

Sascha

> 
> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> index 679ce6e42..321e546f9 100644
> --- a/include/linux/phy/phy.h
> +++ b/include/linux/phy/phy.h
> @@ -195,7 +195,7 @@ static inline struct phy *phy_get(struct device_d *dev, const char *string)
>  static inline struct phy *phy_optional_get(struct device_d *dev,
>  					   const char *string)
>  {
> -	return ERR_PTR(-ENOSYS);
> +	return NULL;
>  }
>  
>  static inline struct phy *of_phy_get_by_phandle(struct device_d *dev,
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list