Re: [PATCH] watchdog: orion_wdt: Use devm APIs for clock and watchdog management

From: Guenter Roeck

Date: Tue May 19 2026 - 20:39:09 EST


On 5/19/26 16:19, Rosen Penev wrote:
On Tue, May 19, 2026 at 4:10 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:

On 5/19/26 15:44, Rosen Penev wrote:
On Tue, May 19, 2026 at 3:34 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:

On Tue, May 19, 2026 at 02:42:29PM -0700, Rosen Penev wrote:
Replace clk_get/clk_prepare_enable/clk_put with devm_clk_get_enabled
and devm_clk_get_optional_enabled so the clock lifecycle is managed
automatically. Switch to devm_watchdog_register_device to eliminate
the manual remove callback and the disable_clk error path.

Switching to devm in these functions is fine as the proper
platform_device is passed in.

Assisted-by: Claude:Sonnet-4.6
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>

drivers/watchdog/orion_wdt.c: In function 'orion_wdt_clock_init':
drivers/watchdog/orion_wdt.c:82:13: error: unused variable 'ret' [-Werror=unused-variable]
82 | int ret;
| ^~~
drivers/watchdog/orion_wdt.c: In function 'armada370_wdt_clock_init':
drivers/watchdog/orion_wdt.c:95:13: error: unused variable 'ret' [-Werror=unused-variable]
95 | int ret;
| ^~~
drivers/watchdog/orion_wdt.c: In function 'armada375_wdt_clock_init':
drivers/watchdog/orion_wdt.c:113:13: error: unused variable 'ret' [-Werror=unused-variable]
113 | int ret;
| ^~~
drivers/watchdog/orion_wdt.c: In function 'armadaxp_wdt_clock_init':
drivers/watchdog/orion_wdt.c:144:13: error: unused variable 'ret' [-Werror=unused-variable]
144 | int ret;

On top of that, the APIs are not 1:1 replaceable.

I am so tired of this. Please stop. I am no longer going to accept any "cleanup"
patches.
If I don't, the bot yells at me. If I do, you yell at me. It seems I
am at an impasse.

The above is the compiler yelling at you.
No I mean my watchdog: orion: Use of_device_get_match_data() patch
resulted in the AI complaining about clock code that I didn't touch.


Problems with your patch:
- It was not identified as bug fix
- It explains what was changed, but not the underlying reason.
"so the clock lifecycle is managed automatically" is not an
explanation and does not explain _why_ the change is necessary.
- It has no Reported-by: tag
- It does not compile
- The APIs are not 1:1 replaceable. At the very least, replacing
of_clk_get_by_name with devm_clk_get_optional_enabled() in one
function and with devm_clk_get_enabled() in another is very suspicious
and asks for a detailed explanation.
- Given that you tried to compile it on ppc very much suggests that it
wasn't tested, and the limited test status was not mentioned in the
patch (not that testing would be easy, given the different means
used to get the clock).

In such a situation it is much better to respond to the agent e-mail
and tell it (and me) that you understand that there is an unrelated
problem, but that you don't have the knowledge/understanding of the
driver and its requirements to submit a fix.

Guenter