]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
HID: pidff: Define values used in pidff_find_special_fields
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Sat, 1 Feb 2025 11:38:59 +0000 (12:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:15:29 +0000 (10:15 +0200)
[ Upstream commit 1c12f136891cf4d2d4e6aa202d671a9d2171a716 ]

Makes it clear where did these values came from

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Reviewed-by: Michał Kopeć <michal@nozomi.space>
Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz>
Tested-by: Paul Dino Jones <paul@spacefreak18.xyz>
Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
Tested-by: Pablo Cisneros <patchkez@protonmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/usbhid/hid-pidff.c

index 42c951a1d65bf4a758b51ba9a53701561c14b7d1..bd913d57e4d75a114c180ef37882e66a634d5d0e 100644 (file)
@@ -48,6 +48,14 @@ static const u8 pidff_reports[] = {
 /* device_control is really 0x95, but 0x96 specified as it is the usage of
 the only field in that report */
 
+/* PID special fields */
+
+#define PID_EFFECT_TYPE                        0x25
+#define PID_DIRECTION                  0x57
+#define PID_EFFECT_OPERATION_ARRAY     0x78
+#define PID_BLOCK_LOAD_STATUS          0x8b
+#define PID_DEVICE_CONTROL_ARRAY       0x96
+
 /* Value usage tables used to put fields and values into arrays */
 
 #define PID_EFFECT_BLOCK_INDEX 0
@@ -1056,23 +1064,24 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
 
        pidff->create_new_effect_type =
                pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT],
-                                        0x25, 1);
+                                        PID_EFFECT_TYPE, 1);
        pidff->set_effect_type =
                pidff_find_special_field(pidff->reports[PID_SET_EFFECT],
-                                        0x25, 1);
+                                        PID_EFFECT_TYPE, 1);
        pidff->effect_direction =
                pidff_find_special_field(pidff->reports[PID_SET_EFFECT],
-                                        0x57, 0);
+                                        PID_DIRECTION, 0);
        pidff->device_control =
                pidff_find_special_field(pidff->reports[PID_DEVICE_CONTROL],
-                       0x96, !(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
+                       PID_DEVICE_CONTROL_ARRAY,
+                       !(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
 
        pidff->block_load_status =
                pidff_find_special_field(pidff->reports[PID_BLOCK_LOAD],
-                                        0x8b, 1);
+                                        PID_BLOCK_LOAD_STATUS, 1);
        pidff->effect_operation_status =
                pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION],
-                                        0x78, 1);
+                                        PID_EFFECT_OPERATION_ARRAY, 1);
 
        hid_dbg(pidff->hid, "search done\n");