ltq-ptm: propagate reset errors to probe
authorRosen Penev <rosenp@gmail.com>
Wed, 4 Sep 2024 18:15:28 +0000 (11:15 -0700)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 6 Sep 2024 20:23:16 +0000 (22:23 +0200)
Instead of avoiding returning, propagate error so that the kernel
infrastructure can handle it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16262
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/lantiq/ltq-ptm/Makefile
package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.h
package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c

index b726cb1560d3eacf5dbd36aa5788b07c334e2b22..03b121887470d0f9f1e0550b80b9b6548a6c9b47 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ltq-ptm
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_MAINTAINER:=John Crispin <john@phrozen.org>
 PKG_LICENSE:=GPL-2.0+
index 8a0ac331b7fe1f834d9c61bbb369d1de57cbefbf..6731904bba9a85f79fdf73c1f91aa355277f815f 100644 (file)
@@ -993,7 +993,9 @@ static int ltq_ptm_probe(struct platform_device *pdev)
         goto INIT_PRIV_DATA_FAIL;
     }
 
-    ifx_ptm_init_chip(pdev);
+    ret = ifx_ptm_init_chip(pdev);
+    if (ret)
+        goto INIT_PRIV_DATA_FAIL;
     ret = init_tables();
     if ( ret != 0 ) {
         err("INIT_TABLES_FAIL");
index 90ed9d9021eb8206568ac419a1883de9f23a7ced..19a86867be13d97a907ff44e390e1632677110d8 100644 (file)
@@ -112,7 +112,7 @@ extern unsigned int ifx_ptm_dbg_enable;
 
 extern void ifx_ptm_get_fw_ver(unsigned int *major, unsigned int *mid, unsigned int *minor);
 
-extern void ifx_ptm_init_chip(struct platform_device *pdev);
+extern int ifx_ptm_init_chip(struct platform_device *pdev);
 extern void ifx_ptm_uninit_chip(void);
 
 extern int ifx_pp32_start(int pp32);
index b1660274d0a7d1415e0197d937ba23c75e4a8707..c0d16fe34fe45625b80f0e343b70db48871ec205 100644 (file)
@@ -54,7 +54,7 @@
 
 static inline void init_pmu(void);
 static inline void uninit_pmu(void);
-static inline void reset_ppe(struct platform_device *pdev);
+static inline int reset_ppe(struct platform_device *pdev);
 static inline void init_pdma(void);
 static inline void init_mailbox(void);
 static inline void init_atm_tc(void);
@@ -82,7 +82,7 @@ static inline void uninit_pmu(void)
 {
 }
 
-static inline void reset_ppe(struct platform_device *pdev)
+static inline int reset_ppe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct reset_control *dsp;
@@ -90,25 +90,16 @@ static inline void reset_ppe(struct platform_device *pdev)
        struct reset_control *tc;
 
        dsp = devm_reset_control_get(dev, "dsp");
-       if (IS_ERR(dsp)) {
-               if (PTR_ERR(dsp) != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to lookup dsp reset\n");
-//             return PTR_ERR(dsp);
-       }
+       if (IS_ERR(dsp))
+               return dev_err_probe(dev, PTR_ERR(dsp), "Failed to lookup dsp reset");
 
        dfe = devm_reset_control_get(dev, "dfe");
-       if (IS_ERR(dfe)) {
-               if (PTR_ERR(dfe) != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to lookup dfe reset\n");
-//             return PTR_ERR(dfe);
-       }
+       if (IS_ERR(dfe))
+               return dev_err_probe(dev, PTR_ERR(dfe), "Failed to lookup dfe reset");
 
        tc = devm_reset_control_get(dev, "tc");
-       if (IS_ERR(tc)) {
-               if (PTR_ERR(tc) != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to lookup tc reset\n");
-//             return PTR_ERR(tc);
-       }
+       if (IS_ERR(tc))
+               return dev_err_probe(dev, PTR_ERR(tc), "Failed to lookup tc reset");
 
        reset_control_assert(dsp);
        udelay(1000);
@@ -120,6 +111,8 @@ static inline void reset_ppe(struct platform_device *pdev)
        udelay(1000);
        *PP32_SRST |= 0x000303CF;
        udelay(1000);
+
+       return 0;
 }
 
 static inline void init_pdma(void)
@@ -263,11 +256,15 @@ void ifx_ptm_get_fw_ver(unsigned int *major, unsigned int *mid, unsigned int *mi
     }
 }
 
-void ifx_ptm_init_chip(struct platform_device *pdev)
+int ifx_ptm_init_chip(struct platform_device *pdev)
 {
+    int r;
+
     init_pmu();
 
-    reset_ppe(pdev);
+    r = reset_ppe(pdev);
+    if (r)
+        return r;
 
     init_pdma();
 
@@ -276,6 +273,8 @@ void ifx_ptm_init_chip(struct platform_device *pdev)
     init_atm_tc();
 
     clear_share_buffer();
+
+    return 0;
 }
 
 void ifx_ptm_uninit_chip(void)