HID: bpf: move the BIT() macro to hid_bpf_helpers.h
authorBenjamin Tissoires <bentiss@kernel.org>
Thu, 27 Jun 2024 09:54:19 +0000 (11:54 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Mon, 1 Jul 2024 12:48:33 +0000 (14:48 +0200)
This macro can be useful in mopre than one place

Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/commit/7970a9c17aa0756bad63e89fccb6ee4f2ec83ccc
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://patch.msgid.link/20240627-import-bpf-v1-3-0dbcda4a5b1f@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/bpf/progs/XPPen__Artist24.bpf.c
drivers/hid/bpf/progs/hid_bpf_helpers.h

index d4d062c3a653b6b2ef50cb788179a5b5fc0f7d16..c24fe905c50d747c292015e8ff747e974dbb5156 100644 (file)
@@ -78,8 +78,6 @@ static const __u8 fixed_rdesc[] = {
        0xc0,                          // End Collection                      106
 };
 
-#define BIT(n) (1UL << n)
-
 #define TIP_SWITCH             BIT(0)
 #define BARREL_SWITCH          BIT(1)
 #define ERASER                 BIT(2)
index 8f226f6e886b56e537fd1032c0f786e3412ed556..3ba24d125a081be4b09d88be4a2afcdc6b8c5f00 100644 (file)
@@ -66,6 +66,7 @@ extern int hid_bpf_hw_request(struct hid_bpf_ctx *ctx,
 #define HID_VID_ANY                            0x0000
 #define HID_PID_ANY                            0x0000
 
+#define BIT(n) (1UL << (n))
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
 /* Helper macro to convert (foo, __LINE__)  into foo134 so we can use __LINE__ for