[RFC PATCH 06/16] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value
Cristian Marussi
cristian.marussi at arm.com
Sun Feb 27 12:55:58 PST 2022
Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
SCMI stack.
Signed-off-by: Cristian Marussi <cristian.marussi at arm.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 7d0b01b59616..5ccee248c22e 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)
@@ -1637,7 +1635,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 0b024d23a9b3..63c1d1cc20ff 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -690,8 +690,11 @@ enum scmi_std_protocol {
SCMI_PROTOCOL_SENSOR = 0x15,
SCMI_PROTOCOL_RESET = 0x16,
SCMI_PROTOCOL_VOLTAGE = 0x17,
+ SCMI_PROTOCOL_LAST = 0xff,
};
+#define SCMI_MAX_PROTOCOLS (SCMI_PROTOCOL_LAST + 1)
+
enum scmi_system_events {
SCMI_SYSTEM_SHUTDOWN,
SCMI_SYSTEM_COLDRESET,
--
2.17.1
More information about the linux-arm-kernel
mailing list