[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250624031351.GC10415@nxa18884-linux>
Date: Tue, 24 Jun 2025 11:13:51 +0800
From: Peng Fan <peng.fan@....nxp.com>
To: Cristian Marussi <cristian.marussi@....com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
arm-scmi@...r.kernel.org, sudeep.holla@....com,
james.quinlan@...adcom.com, f.fainelli@...il.com,
vincent.guittot@...aro.org, etienne.carriere@...com,
michal.simek@....com, quic_sibis@...cinc.com,
dan.carpenter@...aro.org, d-gole@...com, souvik.chakravarty@....com
Subject: Re: [RFC PATCH 1/7] firmware: arm_scmi: Define a common
SCMI_MAX_PROTOCOLS value
On Fri, Jun 20, 2025 at 08:28:07PM +0100, Cristian Marussi wrote:
>Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
>SCMI stack.
>
>Signed-off-by: Cristian Marussi <cristian.marussi@....com>
>---
> drivers/firmware/arm_scmi/notify.c | 4 +---
> include/linux/scmi_protocol.h | 3 +++
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
>index e160ecb22948..27a53a6729dd 100644
>--- a/drivers/firmware/arm_scmi/notify.c
>+++ b/drivers/firmware/arm_scmi/notify.c
>@@ -94,8 +94,6 @@
> #include "common.h"
> #include "notify.h"
>
>-#define SCMI_MAX_PROTO 256
>-
> #define PROTO_ID_MASK GENMASK(31, 24)
> #define EVT_ID_MASK GENMASK(23, 16)
> #define SRC_ID_MASK GENMASK(15, 0)
>@@ -1652,7 +1650,7 @@ int scmi_notification_init(struct scmi_handle *handle)
> ni->gid = gid;
> ni->handle = handle;
>
>- ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
>+ ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTOCOLS,
> sizeof(char *), GFP_KERNEL);
> if (!ni->registered_protocols)
> goto err;
>diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
>index 688466a0e816..6f8d36e1f8fc 100644
>--- a/include/linux/scmi_protocol.h
>+++ b/include/linux/scmi_protocol.h
>@@ -926,8 +926,11 @@ enum scmi_std_protocol {
> SCMI_PROTOCOL_VOLTAGE = 0x17,
> SCMI_PROTOCOL_POWERCAP = 0x18,
> SCMI_PROTOCOL_PINCTRL = 0x19,
>+ SCMI_PROTOCOL_LAST = 0xff,
The enum says this is std protocol, but 0x80~0xff is for vendor extension.
It might confuse others to keep "SCMI_PROTOCOL_LAST" here.
> };
>
>+#define SCMI_MAX_PROTOCOLS (SCMI_PROTOCOL_LAST + 1)
How about "#define SCMI_MAX_PROTOCOLS 256" as the line you removed in notify.c.
Regards
Peng
>+
> enum scmi_system_events {
> SCMI_SYSTEM_SHUTDOWN,
> SCMI_SYSTEM_COLDRESET,
>--
>2.47.0
>
Powered by blists - more mailing lists