Thread (27 messages) 27 messages, 6 authors, 2025-08-25

Re: [PATCH v3 4/4] watchdog: qcom: add support to read the restart reason from IMEM

From: Konrad Dybcio <hidden>
Date: 2025-05-02 22:13:35
Also in: linux-arm-msm, linux-watchdog, lkml

On 5/2/25 6:08 PM, Kathiravan Thirumoorthy wrote:
On 5/2/2025 7:03 PM, Guenter Roeck wrote:
quoted
quoted
  static int qcom_wdt_probe(struct platform_device *pdev)
  {
      struct device *dev = &pdev->dev;
@@ -273,8 +304,13 @@ static int qcom_wdt_probe(struct platform_device *pdev)
      wdt->wdd.parent = dev;
      wdt->layout = data->offset;
  -    if (readl(wdt_addr(wdt, WDT_STS)) & 1)
-        wdt->wdd.bootstatus = WDIOF_CARDRESET;
+    ret = qcom_wdt_get_restart_reason(wdt, data);
+    if (ret == -ENODEV) {
+        if (readl(wdt_addr(wdt, WDT_STS)) & 1)
+            wdt->wdd.bootstatus = WDIOF_CARDRESET;
+    } else if (ret) {
+        return ret;
+    }
Seems odd to me that there is now a function qcom_wdt_get_restart_reason()
but it doesn't handle all means to get the restart reason. Maybe I missed it,
but what is the reason for that ? Why not move reading WDT_STS into
qcom_wdt_get_restart_reason() as well ?

No specific reason as such. I was little hesitant use "goto" statements and such as. So I thought this would be little cleaner approach. Please let me know if I have consolidate everything under qcom_wdt_get_restart_reason().
You can try grabbing the syscon handle, and if absent, fall back to the
common handling

Konrad
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help