aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorBenjamin Tissoires <[email protected]>2024-06-26 15:46:30 +0200
committerBenjamin Tissoires <[email protected]>2024-06-27 11:00:48 +0200
commitfa03f398a8ac46f46927e0b509b302ebe0ed7e8a (patch)
tree0a6577f9023e66ff6e8c01317775f865958fc781 /include/linux
parent3ac83fcd6e67c86d25040e6818972f2c36b51d23 (diff)
HID: bpf: make hid_bpf_input_report() sleep until the device is ready
hid_bpf_input_report() is already marked to be used in sleepable context only. So instead of hammering with timers the device to hopefully get an available slot where the device is not sending events, we can make that kfunc wait for the current event to be terminated before it goes in. This allows to work with the following pseudo code: in struct_ops/hid_device_event: - schedule a bpf_wq, which calls hid_bpf_input_report() - once this struct_ops function terminates, hid_bpf_input_report() immediately starts before the next event Link: https://patch.msgid.link/[email protected] Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hid_bpf.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h
index f35508a73067..7f04353d09e9 100644
--- a/include/linux/hid_bpf.h
+++ b/include/linux/hid_bpf.h
@@ -72,7 +72,8 @@ struct hid_ops {
int (*hid_hw_output_report)(struct hid_device *hdev, __u8 *buf, size_t len,
__u64 source, bool from_bpf);
int (*hid_input_report)(struct hid_device *hid, enum hid_report_type type,
- u8 *data, u32 size, int interrupt, u64 source);
+ u8 *data, u32 size, int interrupt, u64 source,
+ bool lock_already_taken);
struct module *owner;
const struct bus_type *bus_type;
};