Re: [PATCH v4 1/6] powercap: Add generic zone hierarchy creation helpers
From: Lukasz Luba
Date: Fri Oct 30 2026 - 10:01:57 EST
On 10/29/26 16:56, Daniel Lezcano wrote:
Powercap controllers may need to create several powercap zones organized
as a hierarchy. At present, each controller has to open-code the
hierarchy traversal, parent lookup, error rollback and reverse-order
destruction.
Introduce struct powercap_hierarchy to describe a powercap
hierarchy. Each node contains its name, parent, backend-specific data
and the powercap zone created for it.
[snip]
Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>
Cc: Manaf Meethalavalappu Pallikunhi <manaf.pallikunhi@xxxxxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260806110159.69690-2-daniel.lezcano@xxxxxxxxxxxxxxxx
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>
---
Changes in v4 (since v3):
- Rebase on v7.3; no code or commit-description changes.
Changes in v3 (since v2):
- Rebase on v7.3-rc7.
- Add a static initializer and clarify hierarchy ownership and locking.
- Check for existing zones and validate names and parent ordering before
creation; use zone for the runtime pointer member.
- Allow NULL callback results to skip branches; keep errors fatal.
- Use explicit locking and a signed reverse-loop index.
- Explain the controller callbacks, their arguments and their relationship
to zone operations; update the description.
drivers/powercap/powercap_sys.c | 204 +++++++++++++++++++++++++++++++
include/linux/powercap.h | 205 ++++++++++++++++++++++++++++++++
2 files changed, 409 insertions(+)