Skip to content

Commit fcdf830

Browse files
author
Benjamin Tissoires
committed
selftests/hid: ensure CKI can compile our new tests on old kernels
In the same way than commit ae7487d ("selftests/hid: ensure we can compile the tests on kernels pre-6.3") we should expose struct hid_bpf_ops when it's not available in vmlinux.h. So unexpose an eventual struct hid_bpf_ops, include vmlinux.h, and re-export struct hid_bpf_ops. Fixes: d769673 ("selftests/hid: convert the hid_bpf selftests with struct_ops") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent d3e1518 commit fcdf830

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/testing/selftests/hid/progs/hid_bpf_helpers.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
/* "undefine" structs and enums in vmlinux.h, because we "override" them below */
99
#define hid_bpf_ctx hid_bpf_ctx___not_used
10+
#define hid_bpf_ops hid_bpf_ops___not_used
1011
#define hid_report_type hid_report_type___not_used
1112
#define hid_class_request hid_class_request___not_used
1213
#define hid_bpf_attach_flags hid_bpf_attach_flags___not_used
@@ -24,6 +25,7 @@
2425
#include "vmlinux.h"
2526

2627
#undef hid_bpf_ctx
28+
#undef hid_bpf_ops
2729
#undef hid_report_type
2830
#undef hid_class_request
2931
#undef hid_bpf_attach_flags
@@ -68,6 +70,20 @@ enum hid_class_request {
6870
HID_REQ_SET_PROTOCOL = 0x0B,
6971
};
7072

73+
struct hid_bpf_ops {
74+
int hid_id;
75+
u32 flags;
76+
struct list_head list;
77+
int (*hid_device_event)(struct hid_bpf_ctx *ctx, enum hid_report_type report_type,
78+
u64 source);
79+
int (*hid_rdesc_fixup)(struct hid_bpf_ctx *ctx);
80+
int (*hid_hw_request)(struct hid_bpf_ctx *ctx, unsigned char reportnum,
81+
enum hid_report_type rtype, enum hid_class_request reqtype,
82+
u64 source);
83+
int (*hid_hw_output_report)(struct hid_bpf_ctx *ctx, u64 source);
84+
struct hid_device *hdev;
85+
};
86+
7187
#ifndef BPF_F_BEFORE
7288
#define BPF_F_BEFORE (1U << 3)
7389
#endif

0 commit comments

Comments
 (0)