2023-10-03 00:34:50

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 3/4] platform/chrome: cros_typec_vdm: Mark port_amode_ops const

Mark this struct of functions const so it moves to RO memory.

Cc: Prashant Malani <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
---
drivers/platform/chrome/cros_typec_vdm.c | 2 +-
drivers/platform/chrome/cros_typec_vdm.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_vdm.c b/drivers/platform/chrome/cros_typec_vdm.c
index 20515ee0a20e..3f632fd35000 100644
--- a/drivers/platform/chrome/cros_typec_vdm.c
+++ b/drivers/platform/chrome/cros_typec_vdm.c
@@ -142,7 +142,7 @@ static int cros_typec_port_amode_vdm(struct typec_altmode *amode, const u32 hdr,
sizeof(req), NULL, 0);
}

-struct typec_altmode_ops port_amode_ops = {
+const struct typec_altmode_ops port_amode_ops = {
.enter = cros_typec_port_amode_enter,
.vdm = cros_typec_port_amode_vdm,
};
diff --git a/drivers/platform/chrome/cros_typec_vdm.h b/drivers/platform/chrome/cros_typec_vdm.h
index 95a6a75d32b6..631bd2ce4b00 100644
--- a/drivers/platform/chrome/cros_typec_vdm.h
+++ b/drivers/platform/chrome/cros_typec_vdm.h
@@ -5,7 +5,7 @@

#include <linux/usb/typec_altmode.h>

-extern struct typec_altmode_ops port_amode_ops;
+extern const struct typec_altmode_ops port_amode_ops;

void cros_typec_handle_vdm_attention(struct cros_typec_data *typec, int port_num);
void cros_typec_handle_vdm_response(struct cros_typec_data *typec, int port_num);
--
https://chromeos.dev