[PATCH 11/11] HID: wacom: use 'hid_device_id::driver_data_ptr'

From: Pawel Zalewski (The Capable Hub)

Date: Mon May 18 2026 - 12:17:14 EST


Remove the casts to (kernel_ulong_t) and (struct wacom_features *)
and use the 'drvier_data_ptr' field instead to improve readability
of the code.

Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@xxxxxxxxxxxxxxxxxxxx>
---
drivers/hid/wacom_sys.c | 14 +++++++++-----
drivers/hid/wacom_wac.c | 10 +++++-----
2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 0d1c6d90fe21..25408676c5f6 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -2555,8 +2555,9 @@ static void wacom_wireless_work(struct work_struct *work)
}

/* Stylus interface */
- wacom_wac1->features =
- *((struct wacom_features *)id->driver_data);
+ const struct wacom_features *features = id->driver_data_ptr;
+
+ wacom_wac1->features = *features;

wacom_wac1->pid = wacom_wac->pid;
hid_hw_stop(hdev1);
@@ -2568,8 +2569,7 @@ static void wacom_wireless_work(struct work_struct *work)
if (wacom_wac1->features.touch_max ||
(wacom_wac1->features.type >= INTUOSHT &&
wacom_wac1->features.type <= BAMBOO_PT)) {
- wacom_wac2->features =
- *((struct wacom_features *)id->driver_data);
+ wacom_wac2->features = *features;
wacom_wac2->pid = wacom_wac->pid;
hid_hw_stop(hdev2);
error = wacom_parse_and_register(wacom2, true);
@@ -2839,7 +2839,11 @@ static int wacom_probe(struct hid_device *hdev,
wacom->hdev = hdev;

wacom_wac = &wacom->wacom_wac;
- wacom_wac->features = *((struct wacom_features *)id->driver_data);
+
+ const struct wacom_features *id_features = id->driver_data_ptr;
+
+ wacom_wac->features = *id_features;
+
features = &wacom_wac->features;

if (features->check_for_hid_type && features->hid_type != hdev->type)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index da1f0ea85625..034bde5af2df 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -4947,23 +4947,23 @@ static const struct wacom_features wacom_features_0x94 =

#define USB_DEVICE_WACOM(prod) \
HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
- .driver_data = (kernel_ulong_t)&wacom_features_##prod
+ .driver_data_ptr = &wacom_features_##prod

#define BT_DEVICE_WACOM(prod) \
HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
- .driver_data = (kernel_ulong_t)&wacom_features_##prod
+ .driver_data_ptr = &wacom_features_##prod

#define I2C_DEVICE_WACOM(prod) \
HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
- .driver_data = (kernel_ulong_t)&wacom_features_##prod
+ .driver_data_ptr = &wacom_features_##prod

#define PCI_DEVICE_WACOM(prod) \
HID_DEVICE(BUS_PCI, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
- .driver_data = (kernel_ulong_t)&wacom_features_##prod
+ .driver_data_ptr = &wacom_features_##prod

#define USB_DEVICE_LENOVO(prod) \
HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
- .driver_data = (kernel_ulong_t)&wacom_features_##prod
+ .driver_data_ptr = &wacom_features_##prod

const struct hid_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x00) },

--
2.43.0