[PATCH 10/11] HID: hid-tmff: use 'hid_device_id::driver_data_ptr'

From: Pawel Zalewski (The Capable Hub)

Date: Mon May 18 2026 - 12:16:44 EST


Remove the casts to (unsigned long) and instead assign the
'ff_rumble' and 'ff_joystick' variables as they should, as pointers.
Remove the cast to (void *) during probe - tmff_init() second parameter
already accepts a const pointer, so no further action was needed here.
These changes improve readability of the code.

Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@xxxxxxxxxxxxxxxxxxxx>
---
drivers/hid/hid-tmff.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c
index 423f395d01ac..0d7e73fba0fa 100644
--- a/drivers/hid/hid-tmff.c
+++ b/drivers/hid/hid-tmff.c
@@ -226,7 +226,7 @@ static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id)
goto err;
}

- tmff_init(hdev, (void *)id->driver_data);
+ tmff_init(hdev, id->driver_data_ptr);

return 0;
err:
@@ -235,25 +235,25 @@ static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id)

static const struct hid_device_id tm_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300),
- .driver_data = (unsigned long)ff_rumble },
+ .driver_data_ptr = ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304), /* FireStorm Dual Power 2 (and 3) */
- .driver_data = (unsigned long)ff_rumble },
+ .driver_data_ptr = ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, THRUSTMASTER_DEVICE_ID_2_IN_1_DT), /* Dual Trigger 2-in-1 */
- .driver_data = (unsigned long)ff_rumble },
+ .driver_data_ptr = ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323), /* Dual Trigger 3-in-1 (PC Mode) */
- .driver_data = (unsigned long)ff_rumble },
+ .driver_data_ptr = ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb324), /* Dual Trigger 3-in-1 (PS3 Mode) */
- .driver_data = (unsigned long)ff_rumble },
+ .driver_data_ptr = ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb605), /* NASCAR PRO FF2 Wheel */
- .driver_data = (unsigned long)ff_joystick },
+ .driver_data_ptr = ff_joystick },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651), /* FGT Rumble Force Wheel */
- .driver_data = (unsigned long)ff_rumble },
+ .driver_data_ptr = ff_rumble },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653), /* RGT Force Feedback CLUTCH Raging Wheel */
- .driver_data = (unsigned long)ff_joystick },
+ .driver_data_ptr = ff_joystick },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654), /* FGT Force Feedback Wheel */
- .driver_data = (unsigned long)ff_joystick },
+ .driver_data_ptr = ff_joystick },
{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a), /* F430 Force Feedback Wheel */
- .driver_data = (unsigned long)ff_joystick },
+ .driver_data_ptr = ff_joystick },
{ }
};
MODULE_DEVICE_TABLE(hid, tm_devices);

--
2.43.0