phy: core: Use EOPNOTSUPP for disabled blob return value
Subsystems (9)
PATCH 1/1 phy: core: Use EOPNOTSUPP for disabled blob return value
Currently, the phy subsystem uses ENOSYS for dummy blob functions, it does not reflect the function state correctly. As kernel already has EOPNOTSUPP for disabled blob function, replace ENOSYS with EOPNOTSUPP for a clear return value. Also adapt the return value changed in the following affect file:
- ata/libahci_platform.c
- drm/bridge/analogix/analogix_dp_core.c
- usb/dwc2/platform.c
- usb/dwc3/core.c
---
The related discussion for switch to EOPNOTSUPP is at
https://lore.kernel.org/linux-phy/20260907114837.2y55l7dfqqrgcka2@skbuf/
Changed from RFC:
- https://lore.kernel.org/linux-phy/[email protected]/
1. Merge all patch into one to avoid function break.
2. Improve libahci_platform's comment as Damien request.
--- drivers/ata/libahci_platform.c | 6 +-- .../drm/bridge/analogix/analogix_dp_core.c | 2 +- drivers/usb/dwc2/platform.c | 2 +- drivers/usb/dwc3/core.c | 4 +- include/linux/phy/phy.h | 52 +++++++++---------- 5 files changed, 32 insertions(+), 34 deletions(-)
drivers/ata/libahci_platform.c +2 -4
@@ -371,12 +371,10 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port, rc =PTR_ERR (hpriv->phys[port]);switch (rc) { -case -ENOSYS : +case -EOPNOTSUPP :/* No PHY support. Check if PHY is required. */ if (of_property_present (node,"phys" )) { -dev_err (dev, -"couldn't get PHY in node %pOFn: ENOSYS\n" , - node); +dev_err (dev,"Node %pOFn: PHY not supported\n" , node);break ; } fallthrough;
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 -1
@@ -1360,7 +1360,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)* phy itself is not enabled, so we can move forward * assigning NULL to phy pointer. */ -if (ret == -ENOSYS || ret == -ENODEV ) +if (ret == -EOPNOTSUPP || ret == -ENODEV ) dp->phy =NULL ;else return ERR_PTR (ret);
drivers/usb/dwc2/platform.c +1 -1
@@ -243,7 +243,7 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) ret =PTR_ERR (hsotg->phy);switch (ret) {case -ENODEV : -case -ENOSYS : +case -EOPNOTSUPP : hsotg->phy =NULL ;break ;default :
drivers/usb/dwc3/core.c +2 -2
@@ -1588,7 +1588,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc) dwc->usb2_generic_phy[i] =devm_phy_get (dev, phy_name);if (IS_ERR (dwc->usb2_generic_phy[i])) { ret =PTR_ERR (dwc->usb2_generic_phy[i]); -if (ret == -ENOSYS || ret == -ENODEV ) +if (ret == -EOPNOTSUPP || ret == -ENODEV ) dwc->usb2_generic_phy[i] =NULL ;else return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
@@ -1605,7 +1605,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc) dwc->usb3_generic_phy[i] =devm_phy_get (dev, phy_name);if (IS_ERR (dwc->usb3_generic_phy[i])) { ret =PTR_ERR (dwc->usb3_generic_phy[i]); -if (ret == -ENOSYS || ret == -ENODEV ) +if (ret == -EOPNOTSUPP || ret == -ENODEV ) dwc->usb3_generic_phy[i] =NULL ;else return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
include/linux/phy/phy.h +26 -26
203 lines not on this page · raw message
--
2.55.0
Damien Le Moal
maintainerQuoted 2 lines · Inochi Amaoto
Currently, the phy subsystem uses ENOSYS for dummy blob functions, it does not reflect the function state correctly. As kernel already
s/function state/hardware capability ?
s/As kernel/As the kernel
Quoted 1 line
has EOPNOTSUPP for disabled blob function, replace ENOSYS with
What is "blob function" ? Are you talking about all the phy_xxx() functions?
Quoted 2 lines
EOPNOTSUPP for a clear return value. Also adapt the return value changed in the following affect file:
s/affect/affected
Quoted 6 lines
-
ata/libahci_platform.c
-drm/bridge/analogix/analogix_dp_core.c
-usb/dwc2/platform.c
-usb/dwc3/core.cSigned-off-by Inochi Amaoto <[email protected]>
The ata bits looks OK, but this still feels like a lot of churn for no functional change since the error is an internal one that is not exposed to the user, as far as I can tell. The code in many places also uses -ENODEV, so the error returned does not seem to be consistent anyway.
Signature · 2 lines
Damien Le Moal Western Digital Research