]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
phy: qcom-sgmii-eth: remove qcom_dwmac_sgmii_phy_interface()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 3 Mar 2026 15:53:56 +0000 (15:53 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 6 Mar 2026 02:43:06 +0000 (18:43 -0800)
Now that qcom_dwmac_sgmii_phy_interface() only serves to validate the
passed interface mode, combine it with qcom_dwmac_sgmii_phy_validate(),
and use qcom_dwmac_sgmii_phy_validate() to validate the mode in
qcom_dwmac_sgmii_phy_set_mode().

Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vxS4K-0000000BQXm-0OJL@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/phy/qualcomm/phy-qcom-sgmii-eth.c

index 58ff156012065c8a7d443c788f608b8599a8efda..6332ff291fdf558b3c434f61c0fb04bd783dbf9e 100644 (file)
@@ -290,7 +290,9 @@ static int qcom_dwmac_sgmii_phy_power_off(struct phy *phy)
        return 0;
 }
 
-static int qcom_dwmac_sgmii_phy_interface(enum phy_mode mode, int submode)
+static int qcom_dwmac_sgmii_phy_validate(struct phy *phy, enum phy_mode mode,
+                                        int submode,
+                                        union phy_configure_opts *opts)
 {
        if (mode != PHY_MODE_ETHERNET)
                return -EINVAL;
@@ -298,7 +300,7 @@ static int qcom_dwmac_sgmii_phy_interface(enum phy_mode mode, int submode)
        if (submode == PHY_INTERFACE_MODE_SGMII ||
            submode == PHY_INTERFACE_MODE_1000BASEX ||
            submode == PHY_INTERFACE_MODE_2500BASEX)
-               return submode;
+               return 0;
 
        return -EINVAL;
 }
@@ -307,27 +309,18 @@ static int qcom_dwmac_sgmii_phy_set_mode(struct phy *phy, enum phy_mode mode,
                                         int submode)
 {
        struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy);
-       int interface;
+       int ret;
 
-       interface = qcom_dwmac_sgmii_phy_interface(mode, submode);
-       if (interface < 0)
-               return interface;
+       ret = qcom_dwmac_sgmii_phy_validate(phy, mode, submode, NULL);
+       if (ret)
+               return ret;
 
-       if (interface != data->interface)
-               data->interface = interface;
+       if (submode != data->interface)
+               data->interface = submode;
 
        return qcom_dwmac_sgmii_phy_calibrate(phy);
 }
 
-static int qcom_dwmac_sgmii_phy_validate(struct phy *phy, enum phy_mode mode,
-                                        int submode,
-                                        union phy_configure_opts *opts)
-{
-       int ret = qcom_dwmac_sgmii_phy_interface(mode, submode);
-
-       return ret < 0 ? ret : 0;
-}
-
 static const struct phy_ops qcom_dwmac_sgmii_phy_ops = {
        .power_on       = qcom_dwmac_sgmii_phy_power_on,
        .power_off      = qcom_dwmac_sgmii_phy_power_off,