Repository navigation
drm/apple: dcp: leave the bind's clocks to its devres group - #2832
Conversation
dcp_comp_unbind() put dcp->clk with devm_clk_put(). That walks every devm clock entry of the device, and the optional "clock-194" lookup leaves an entry whose clock is NULL when the node has no such clock. devm_clk_match() warns on that entry (clk-devres.c), so every unbind of a DCP without clock-194 printed a WARNING with a stack trace. On a J473 this shows whenever another DCP fails to bind and the component framework unbinds the DCP that already bound. Both clocks are got during bind inside the devres group the component framework opens for it, and component_unbind() releases that group right after the unbind callback. Drop the explicit put and only clear the pointers, as was already done for clk_194. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 419a05c. Correct. Notes, none blocking:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR Checklist Review (§1–§6) — 419a05c37b8071c7e1d01cb3df8af45a08e8edea
Reviewed full diff, devres/component lifecycle, error paths, commit metadata, and CI status. LGTM.
- Root cause & devres lifetime verified: Both
dcp->clk(devm_clk_get_optional/devm_clk_get) anddcp->clk_194(devm_clk_get_optional) are acquired indcp_comp_bind_pipe()(dcp.c:6649-6664) inside the component bind devres group (component_bind()->devres_open_group(component->dev, component, ...)). Whenclock-194is absent,devm_clk_get_optional()registers adevm_clk_statewithstate->clk == NULL. Callingdevm_clk_put(dev, dcp->clk)indcp_comp_unbind()walkeddevm_clk_releaseentries in LIFO order, hit the NULLclk_194entry first, and trippedWARN_ON(!c || !*c)atdrivers/clk/clk-devres.c:323. - Teardown & error paths verified:
- Normal unbind:
component_unbind()immediately callsdevres_release_group(component->dev, component)(drivers/base/component.c:600), putting both clocks cleanly (clk_put(NULL)is a no-op). - Bind failure /
-EPROBE_DEFER:component_bind()rolls back the devres group automatically on error;ext_failsaferetains the group until unbind/remove (and already bypasseddevm_clk_put()via theext_deadearly return). - Teardown ordering:
dcp->clkanddcp->clk_194are neverclk_prepare_enable()/clk_disable_unprepare()'d indcp.c(only rate-queried), and both pointers are cleared toNULLbefore returning fromdcp_comp_unbind(), so deferringclk_put()to the immediately followingdevres_release_group()has no ordering impact. - Direct
dcp_comp_unbind(&pdev->dev, NULL, NULL)indcp_platform_shutdown()(dcp.c:8013, 8021): harmless at power-off (M4 never gets clocks indcp_comp_bind_pipe(), andretain_dmaH17P external intentionally keeps its bind devres group across shutdown).
- Normal unbind:
- §1–§6 Checklist:
- §1 No model gating: Pass (shared component unbind path, zero chip/board checks).
- §2 Production-ready: Pass (default cmdline, removes broken explicit
devm_clk_put()). - §3 Safety: Pass.
- §4 Clean-room & attribution: Pass (human author/committer
Ryan Murray <ryan@aurorasilicon.org>, humanSigned-off-by, zero AI trailers in commits). - §5 Evidence: Verified before/after A/B on J473 (M2 Mac mini, T8112) eliminating the
devm_clk_matchWARNING with 0 warnings in boot journal, enforcing, 0 AVC; plusrun-host-tests.py --only dcp34/34 and CIhost-testsgreen. (Non-blocking: the PR notes an optional follow-up unbind row on another M1/M2 ref Mac, and a one-line mention ofdcp_platform_shutdown()in the commit message would be nice-to-have if amended.) - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
|
Merge-train adversarial review (MERGETRAIN-LINUX4) at 419a05c: no blockers. Merges clean on integration/aurora, alone and together with #2828-#2832. Full reviewVERDICT: NO BLOCKERS Blockers: none. Checked:
Nits (not blocking):
Assisted-by: LLM (Claude:Opus 5.5) |
Problem
dcp_comp_unbind()releasesdcp->clkwithdevm_clk_put(). That walks every devm clock entry on the device. The optionalclock-194lookup leaves an entry with a NULL clock on nodes that have no such clock, anddevm_clk_match()warns on it. So every unbind of such a DCP prints a WARNING with a stack trace. On the M2 Mac mini (J473) it shows each time the HDMI DCP fails to bind and the component framework unbinds the DCP that already bound.Change
Both clocks are got during bind, inside the devres group the component framework opens for that bind.
component_unbind()releases the group right after the unbind callback. So drop the explicit put and only clear the pointers, as the code already did forclk_194. No behaviour change apart from the missing warning.Testing
WARNING: drivers/clk/clk-devres.c:323 at devm_clk_match, called fromdevm_clk_putindcp_comp_unbind.tools/asahi/run-host-tests.py --only dcp): 34/34 pass, including the KUnitapple-dcprun that callsdcp_comp_unbind().Still to run
Reviewer detail
devm_clk_match():if (!c || !*c) { WARN_ON(!c || !*c); return 0; }.devm_clk_get_optional(dev, "clock-194")registers a devres whose clock is NULL when the property is absent, anddevm_clk_put(dev, dcp->clk)runs the match over everydevm_clk_releaseentry of the device.dcp->clkanddcp->clk_194are acquired indcp_comp_bind_pipe(), which the component framework calls insidedevres_open_group(component->dev, component, ...).component_unbind()callsdevres_release_group(component->dev, component)after->unbind(), which puts both clocks.dcp_platform_shutdown()also callsdcp_comp_unbind()directly on some paths. There the clock reference is left to the device's lifetime, which is harmless at power-off. Nothing else used the put for ordering (no clk_disable in unbind).Assisted-by: LLM (Claude:Opus 5.5)