Skip to content

Commit f9a11da

Browse files
t-8chBenjamin Tissoires
authored andcommitted
HID: bpf: constify hid_ops
The hid_ops struct is never modified. Mark it as const. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20241127-hid-bpf-ops-v1-1-f9e41bfa3afd@weissschuh.net Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
1 parent e8f3474 commit f9a11da

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/hid/bpf/hid_bpf_dispatch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/module.h>
2020
#include "hid_bpf_dispatch.h"
2121

22-
struct hid_ops *hid_ops;
22+
const struct hid_ops *hid_ops;
2323
EXPORT_SYMBOL(hid_ops);
2424

2525
u8 *

drivers/hid/hid-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,7 @@ int hid_check_keys_pressed(struct hid_device *hid)
30643064
EXPORT_SYMBOL_GPL(hid_check_keys_pressed);
30653065

30663066
#ifdef CONFIG_HID_BPF
3067-
static struct hid_ops __hid_ops = {
3067+
static const struct hid_ops __hid_ops = {
30683068
.hid_get_report = hid_get_report,
30693069
.hid_hw_raw_request = __hid_hw_raw_request,
30703070
.hid_hw_output_report = __hid_hw_output_report,

include/linux/hid_bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct hid_ops {
7878
const struct bus_type *bus_type;
7979
};
8080

81-
extern struct hid_ops *hid_ops;
81+
extern const struct hid_ops *hid_ops;
8282

8383
/**
8484
* struct hid_bpf_ops - A BPF struct_ops of callbacks allowing to attach HID-BPF

0 commit comments

Comments
 (0)