[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241127-hid-bpf-ops-v1-1-f9e41bfa3afd@weissschuh.net>
Date: Wed, 27 Nov 2024 17:41:56 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Jiri Kosina <jikos@...nel.org>, Benjamin Tissoires <bentiss@...nel.org>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH] HID: bpf: constify hid_ops
The hid_ops struct is never modified. Mark it as const.
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
drivers/hid/bpf/hid_bpf_dispatch.c | 2 +-
drivers/hid/hid-core.c | 2 +-
include/linux/hid_bpf.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c
index 961b7f35aa673618abbb7bf2edc18cd3ef7c90f4..e8be9ab51d6323b6ee356be3f7c49b958984fb59 100644
--- a/drivers/hid/bpf/hid_bpf_dispatch.c
+++ b/drivers/hid/bpf/hid_bpf_dispatch.c
@@ -19,7 +19,7 @@
#include <linux/module.h>
#include "hid_bpf_dispatch.h"
-struct hid_ops *hid_ops;
+const struct hid_ops *hid_ops;
EXPORT_SYMBOL(hid_ops);
u8 *
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 98bef39642a9e3008e60a60fa887b8328ccd50f5..33a19197332488bd232dcee510d9da9ffec770bc 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -3064,7 +3064,7 @@ int hid_check_keys_pressed(struct hid_device *hid)
EXPORT_SYMBOL_GPL(hid_check_keys_pressed);
#ifdef CONFIG_HID_BPF
-static struct hid_ops __hid_ops = {
+static const struct hid_ops __hid_ops = {
.hid_get_report = hid_get_report,
.hid_hw_raw_request = __hid_hw_raw_request,
.hid_hw_output_report = __hid_hw_output_report,
diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h
index a6876ab29004892b78eb32135ec52cd0417503fe..a2e47dbcf82c8bbbc547ebc18c82e11bfe8c6236 100644
--- a/include/linux/hid_bpf.h
+++ b/include/linux/hid_bpf.h
@@ -78,7 +78,7 @@ struct hid_ops {
const struct bus_type *bus_type;
};
-extern struct hid_ops *hid_ops;
+extern const struct hid_ops *hid_ops;
/**
* struct hid_bpf_ops - A BPF struct_ops of callbacks allowing to attach HID-BPF
---
base-commit: aaf20f870da056752f6386693cc0d8e25421ef35
change-id: 20241127-hid-bpf-ops-bf718aa42eb0
Best regards,
--
Thomas Weißschuh <linux@...ssschuh.net>
Powered by blists - more mailing lists