From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: clk: Add __clk_disable_unprepare_counts_only() helper
Date: Thu, 28 May 2026 12:34:29 +1000 [thread overview]
Message-ID: <review-patch1-20260527094811.116977-2-johannes.goede@oss.qualcomm.com> (raw)
In-Reply-To: <20260527094811.116977-2-johannes.goede@oss.qualcomm.com>
Patch Review
**pm_runtime leak/hazard in unprepare path:**
The patch gates `core->ops->unprepare` with the new `call_unprepare_op` flag, but `clk_pm_runtime_put(core)` at the end of `clk_core_unprepare()` is still called unconditionally:
```c
if (call_unprepare_op && core->ops->unprepare)
core->ops->unprepare(core->hw);
trace_clk_unprepare_complete(core);
clk_core_unprepare(core->parent, call_unprepare_op);
clk_pm_runtime_put(core); // <-- still called in counts-only mode
```
When `clk_core_prepare()` was called by simpledrm, it called `clk_pm_runtime_get()` (line 1110 of clk.c in drm-next). The matching `clk_pm_runtime_put()` calls `pm_runtime_put_sync()`, which can trigger the clock controller device's `runtime_suspend` callback. If simpledrm held the only prepare reference on clocks from a given controller, this could power down the controller's power domain — exactly the kind of hardware disturbance the series is trying to avoid.
This should either be gated the same way as the ops callback, or the rationale for why it's safe should be documented.
**Misleading tracepoints:**
`trace_clk_unprepare` / `trace_clk_unprepare_complete` and `trace_clk_disable` / `trace_clk_disable_complete` fire regardless of the `call_*_op` flag. When no actual disable/unprepare happens, these trace events are misleading and could confuse ftrace-based debugging. Consider gating them with the same boolean, or adding distinct trace events for counts-only operations.
**WARN for CLK_IS_CRITICAL:**
In the counts-only path, the WARN for decrementing a critical clock's last reference still fires:
```c
if (WARN(core->enable_count == 1 && core->flags & CLK_IS_CRITICAL,
"Disabling critical %s\n", core->name))
return;
```
While CLK_IS_CRITICAL clocks shouldn't appear in simple-framebuffer DT nodes, the semantic is arguably wrong: we're not "disabling" the clock, we're releasing a count. This is a minor concern but could be confusing if it triggers.
**API naming and export:**
The function is `EXPORT_SYMBOL_GPL` and the `__` prefix clearly signals "internal/unusual." The kerneldoc is good. Consider whether a `clk_release_counts()` or `clk_detach_counts()` name would be clearer, since the function doesn't disable or unprepare anything.
**Overall correctness of the bool-parameter approach:**
Adding `bool call_unprepare_op` / `bool call_disable_op` to internal functions is a reasonable pattern (the cover letter correctly notes that duplicating the logic is worse). The changes to all existing callers to pass `true` are mechanically correct — I verified each call site:
- `clk_core_unprepare_lock()` — passes `true` ✓
- `clk_core_prepare()` error path — passes `true` ✓
- `clk_change_rate()` — passes `true` ✓
- `__clk_core_init()` — passes `true` ✓
- `clk_core_disable_lock()` — passes `true` ✓
- `clk_core_enable()` error path — passes `true` ✓
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-28 2:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 9:48 [PATCH 0/3] clk: Add __clk_disable_unprepare_counts_only() and use this in simple[fb|drm] Hans de Goede
2026-05-27 9:48 ` [PATCH 1/3] clk: Add __clk_disable_unprepare_counts_only() helper Hans de Goede
2026-05-28 2:34 ` Claude Code Review Bot [this message]
2026-05-27 9:48 ` [PATCH 2/3] drm/sysfb: simpledrm: Use __clk_disable_unprepare_counts_only() Hans de Goede
2026-05-28 2:34 ` Claude review: " Claude Code Review Bot
2026-05-27 9:48 ` [PATCH 3/3] fbdev: simplefb: " Hans de Goede
2026-05-28 2:34 ` Claude review: " Claude Code Review Bot
2026-05-27 12:04 ` [PATCH 0/3] clk: Add __clk_disable_unprepare_counts_only() and use this in simple[fb|drm] Maxime Ripard
2026-05-27 12:21 ` Hans de Goede
2026-05-27 12:48 ` Maxime Ripard
2026-05-27 15:09 ` Hans de Goede
2026-05-27 23:03 ` Brian Masney
2026-05-28 2:34 ` Claude review: " Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=review-patch1-20260527094811.116977-2-johannes.goede@oss.qualcomm.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox