xref: /linux/tools/testing/selftests/hid/progs/hid_bpf_helpers.h (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2022 Benjamin Tissoires
3  */
4 
5 #ifndef __HID_BPF_HELPERS_H
6 #define __HID_BPF_HELPERS_H
7 
8 /* following are kfuncs exported by HID for HID-BPF */
9 extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx,
10 			      unsigned int offset,
11 			      const size_t __sz) __ksym;
12 extern int hid_bpf_attach_prog(unsigned int hid_id, int prog_fd, u32 flags) __ksym;
13 extern struct hid_bpf_ctx *hid_bpf_allocate_context(unsigned int hid_id) __ksym;
14 extern void hid_bpf_release_context(struct hid_bpf_ctx *ctx) __ksym;
15 extern int hid_bpf_hw_request(struct hid_bpf_ctx *ctx,
16 			      __u8 *data,
17 			      size_t buf__sz,
18 			      enum hid_report_type type,
19 			      enum hid_class_request reqtype) __ksym;
20 
21 #endif /* __HID_BPF_HELPERS_H */
22