The commit 374ca551cca9 ("s32g: serdes: add new function get_lane_id to
retrieve lane_id") introduced a new function get_lane_id() to retrieve
the right lane id for serdes phy, so we need to update the serdes
driver to get the right phy id using this function in all the related
places, or else, there will be call trace when rmmod the pfeng driver,
like following:

    Call trace:
        kfree+0x74/0x360
        regcache_exit+0x38/0x80
        regmap_exit+0x28/0x15c
        xpcs_release+0x2c/0x50
        serdes_phy_release+0x48/0x60
        of_phy_put+0x4c/0x80
        devm_phy_release+0x30/0x40
        release_nodes+0x7c/0x12c
        devres_release_all+0x90/0xf0
        __device_release_driver+0x1a0/0x250
        driver_detach+0xcc/0x110
        bus_remove_driver+0x64/0xc0
        driver_unregister+0x3c/0x6c
        platform_driver_unregister+0x20/0x30
        pfeng_platform_driver_exit+0x1c/0xc1c [pfeng]
        __arm64_sys_delete_module+0x184/0x210
        invoke_syscall+0x5c/0x130
        el0_svc_common.constprop.0+0x4c/0x100
        do_el0_svc+0x50/0xb4
        el0_svc+0x28/0x80
        el0t_64_sync_handler+0xa4/0x130
        el0t_64_sync+0x1a0/0x1a4

This patch is to fix it.

Signed-off-by: Zhantao Tang <[email protected]>
---
 drivers/phy/freescale/phy-fsl-s32gen1-serdes.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/freescale/phy-fsl-s32gen1-serdes.c 
b/drivers/phy/freescale/phy-fsl-s32gen1-serdes.c
index 6604a19e7040..4e8bb8d898cd 100644
--- a/drivers/phy/freescale/phy-fsl-s32gen1-serdes.c
+++ b/drivers/phy/freescale/phy-fsl-s32gen1-serdes.c
@@ -414,7 +414,7 @@ static void xpcs_phy_release(struct phy *p)
 {
        struct serdes *serdes = phy_get_drvdata(p);
        struct xpcs_ctrl *xpcs = &serdes->xpcs;
-       int id = p->id;
+       int id = get_lane_id(p);
 
        xpcs->ops->release(xpcs->phys[id]);
        xpcs->phys[id] = NULL;
@@ -423,12 +423,13 @@ static void xpcs_phy_release(struct phy *p)
 static int serdes_phy_init(struct phy *p)
 {
        struct serdes *serdes = phy_get_drvdata(p);
+       int id = get_lane_id(p);
 
        if (p->attrs.mode == PHY_MODE_PCIE)
                return 0;
 
        if (p->attrs.mode == PHY_MODE_ETHERNET)
-               return xpcs_phy_init(serdes, p->id);
+               return xpcs_phy_init(serdes, id);
 
        return -EINVAL;
 }
@@ -436,7 +437,7 @@ static int serdes_phy_init(struct phy *p)
 static int serdes_phy_set_mode_ext(struct phy *p,
                                   enum phy_mode mode, int submode)
 {
-       int id = p->id;
+       int id = get_lane_id(p);
        struct serdes *serdes = phy_get_drvdata(p);
 
        if (p->attrs.mode != PHY_MODE_PCIE)
@@ -480,12 +481,13 @@ static void serdes_phy_release(struct phy *p)
 static int serdes_phy_power_on(struct phy *p)
 {
        struct serdes *serdes = phy_get_drvdata(p);
+       int id = get_lane_id(p);
 
        if (p->attrs.mode == PHY_MODE_PCIE)
-               return pcie_phy_power_on(serdes, p->id);
+               return pcie_phy_power_on(serdes, id);
 
        if (p->attrs.mode == PHY_MODE_ETHERNET)
-               return xpcs_phy_power_on(serdes, p->id);
+               return xpcs_phy_power_on(serdes, id);
 
        return 0;
 }
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#11551): 
https://lists.yoctoproject.org/g/linux-yocto/message/11551
Mute This Topic: https://lists.yoctoproject.org/mt/92908430/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to