firmware: arm_scmi: Simplify notification allocations

Several SCMI notification data structures allocate a descriptor and then
allocate a fixed-size array referenced by that descriptor.

Use flexible array members for per-protocol registered events and
per-event source refcounts so each descriptor and its array can be
allocated together. Annotate the flexible arrays with __counted_by() and
assign the count fields immediately after allocation, before any array
access.

The registered_protocols table has a fixed SCMI_MAX_PROTO size, so embed
it directly in the notification instance instead of allocating it
separately.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260630204719.334211-1-rosenp@gmail.com
(sudeep.holla: Updated title and improved change description)
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
This commit is contained in:
Rosen Penev 2026-06-30 13:47:19 -07:00 • committed by Sudeep Holla
commit 9c62bb72a5