]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dpll: Enhance and consolidate reference counting logic
authorIvan Vecera <ivecera@redhat.com>
Tue, 3 Feb 2026 17:39:59 +0000 (18:39 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 5 Feb 2026 14:57:46 +0000 (15:57 +0100)
commit729f5e0153bda8c0423fb7c5795865b6b77ca050
tree60f56812f19dd5aa66205bdb6b7bca08b2db952a
parentfdad05ed4ec23b8de23c0037cea9aedbdc9cd24b
dpll: Enhance and consolidate reference counting logic

Refactor the reference counting mechanism for DPLL devices and pins to
improve consistency and prevent potential lifetime issues.

Introduce internal helpers __dpll_{device,pin}_{hold,put}() to
centralize reference management.

Update the internal XArray reference helpers (dpll_xa_ref_*) to
automatically grab a reference to the target object when it is added to
a list, and release it when removed. This ensures that objects linked
internally (e.g., pins referenced by parent pins) are properly kept
alive without relying on the caller to manually manage the count.

Consequently, remove the now redundant manual `refcount_inc/dec` calls
in dpll_pin_on_pin_{,un}register()`, as ownership is now correctly handled
by the dpll_xa_ref_* functions.

Additionally, ensure that dpll_device_{,un}register()` takes/releases
a reference to the device, ensuring the device object remains valid for
the duration of its registration.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Link: https://patch.msgid.link/20260203174002.705176-7-ivecera@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/dpll/dpll_core.c