Skip to content

Commit

Permalink
HID: bpf: constify hid_ops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Weißschuh authored and Benjamin Tissoires committed Nov 28, 2024
1 parent e8f3474 commit f9a11da
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/hid/bpf/hid_bpf_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion include/linux/hid_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9a11da

Please sign in to comment.