[PATCH v2 03/17] firmware: arm_scmi: Allow protocols to register for notifications
Jonathan Cameron
jonathan.cameron at huawei.com
Mon Jan 19 03:33:26 PST 2026
On Wed, 14 Jan 2026 11:46:07 +0000
Cristian Marussi <cristian.marussi at arm.com> wrote:
> Allow protocols themselves to register for their own notifications and
and provide their own notifier callbacks.
> providing their own notifier callbacks. While at that, allow for a protocol
> to register events with compilation-time unknown report/event sizes: such
> events will use the maximum transport size.
I'm not keen on the 'while at that' part of the patch. In an ideal
world that's a separate patch.
One other comment inline.
Jonathan
p.s. You get to my review victim whilst I run a particularly annoying
bisection on the other screen (completely unrelated!) :)
>
> Signed-off-by: Cristian Marussi <cristian.marussi at arm.com>
> ---
> v1-->v2
> - Fixed multiline comment format
> ---
> drivers/firmware/arm_scmi/common.h | 4 ++++
> drivers/firmware/arm_scmi/driver.c | 12 ++++++++++++
> drivers/firmware/arm_scmi/notify.c | 28 ++++++++++++++++++++-------
> drivers/firmware/arm_scmi/notify.h | 8 ++++++--
> drivers/firmware/arm_scmi/protocols.h | 6 ++++++
> 5 files changed, 49 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
> index 78e9e27dc9ec..e84b4dbefe82 100644
> --- a/drivers/firmware/arm_scmi/notify.c
> +++ b/drivers/firmware/arm_scmi/notify.c
> @@ -779,8 +787,13 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id,
> }
>
> evt = ee->evts;
> - for (i = 0; i < ee->num_events; i++)
> + for (i = 0; i < ee->num_events; i++) {
> + if (evt[i].max_payld_sz == 0) {
> + payld_sz = max_msg_sz;
> + break;
> + }
> payld_sz = max_t(size_t, payld_sz, evt[i].max_payld_sz);
Everything here seems to already be a size_t. It is rare that we actually need max_t over
max, and definitely not when all the types match.
payld_sz = max(payl_sz, evt[i].max_payld_sz);
> + }
> payld_sz += sizeof(struct scmi_event_header);
More information about the linux-arm-kernel
mailing list