Commit 50fe0fc6 authored by Benjamin Tissoires's avatar Benjamin Tissoires
Browse files

HID: bpf: convert in-tree fixes into struct_ops

Very mechanical:
- Change HID_BPF_DEVICE_EVENT and HID_BPF_RDESC_FIXUP #defines
- add a matching SEC(".struct_ops.link")
- in ArtistPro16Gen2 make the 2 functions static and have a new one
  calling them

Link: https://lore.kernel.org/r/20240608-hid_bpf_struct_ops-v3-7-6ac6ade58329@kernel.org


Signed-off-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
parent df67602f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -168,6 +168,11 @@ int BPF_PROG(raptor_mach_2_fix_hat_switch, struct hid_bpf_ctx *hctx)
	return 0;
}

HID_BPF_OPS(raptor_mach_2) = {
	.hid_rdesc_fixup = (void *)hid_fix_rdesc_raptor_mach_2,
	.hid_device_event = (void *)raptor_mach_2_fix_hat_switch,
};

SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
+4 −0
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@ int BPF_PROG(hid_fix_rdesc, struct hid_bpf_ctx *hctx)
	return 0;
}

HID_BPF_OPS(hp_elite_presenter) = {
	.hid_rdesc_fixup = (void *)hid_fix_rdesc,
};

SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
+5 −0
Original line number Diff line number Diff line
@@ -255,6 +255,11 @@ int BPF_PROG(kamvas_pro_19_fix_3rd_button, struct hid_bpf_ctx *hctx)
	return 0;
}

HID_BPF_OPS(huion_Kamvas_pro_19) = {
	.hid_rdesc_fixup = (void *)hid_fix_rdesc_huion_kamvas_pro_19,
	.hid_device_event = (void *)kamvas_pro_19_fix_3rd_button,
};

SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
+4 −0
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@ int BPF_PROG(hid_fix_rdesc, struct hid_bpf_ctx *hctx)
	return 0;
}

HID_BPF_OPS(iogear_kaliber_momentum) = {
	.hid_rdesc_fixup = (void *)hid_fix_rdesc,
};

SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
+4 −0
Original line number Diff line number Diff line
@@ -114,6 +114,10 @@ int BPF_PROG(hid_fix_rdesc, struct hid_bpf_ctx *hctx)
	return 0;
}

HID_BPF_OPS(xbox_elite_2) = {
	.hid_rdesc_fixup = (void *)hid_fix_rdesc,
};

SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
Loading