Re: [PATCH v6 3/3] watchdog: mt7621-wdt: avoid ralink architecture dependent code
From: Krzysztof Kozlowski <hidden>
Date: 2023-02-14 09:54:42
Also in:
linux-mips, linux-watchdog, lkml
On 14/02/2023 10:50, Sergio Paracuellos wrote:
On Tue, Feb 14, 2023 at 10:33 AM Krzysztof Kozlowski [off-list ref] wrote:quoted
On 14/02/2023 09:54, Sergio Paracuellos wrote:quoted
quoted
quoted
return 0;@@ -143,6 +147,10 @@ static int mt7621_wdt_probe(struct platform_device *pdev) if (!drvdata) return -ENOMEM; + drvdata->sysc = syscon_regmap_lookup_by_compatible("mediatek,mt7621-sysc"); + if (IS_ERR(drvdata->sysc)) + return PTR_ERR(drvdata->sysc);This should be the backup/error path for original code using syscon property. Looking up by compatible is really not portable/re-usable.I can change the code in the way you are pointing out here but... Why is it not re-usable? Compatible is not supposed to be changed since in other cases the DTB ABI will be broken. I am totally lost about what is an ABI breakage, then.How do you use it on other platform?I see, thanks. So if I am understanding you correctly I have to maintain the 'mediatek,sysctl' phandle and use it in the first instance and if it fails I have to use regmap_loopup_by_compatible() stuff, right? Something like: ... drvdata->sysc = syscon_regmap_lookup_by_phandle(np, "mediatek,sysctl"); if (IS_ERR(drvdata->sysc)) { drvdata->sysc = syscon_regmap_lookup_by_compatible("mediatek,mt7621-sysc"); if (IS_ERR(drvdata->sysc)) return PTR_ERR(drvdata->sysc); } .... So in that case, we can add the new phandle to the bindings without any kind of ABI breakage and we can use old dtbs using new watchdog driver code.
Yes. Best regards, Krzysztof