]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
HID: hid-cypress: clean up usage of 'driver_data'
authorPawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
Mon, 18 May 2026 16:06:25 +0000 (17:06 +0100)
committerBenjamin Tissoires <bentiss@kernel.org>
Mon, 1 Jun 2026 16:28:41 +0000 (18:28 +0200)
commit73e784ddf895416ec03d3760300f6050324cfe52
tree2a3641b9313014470d8742b54bde6b02f0819bbe
parent4de4b8a5ddc2c5a2e0f62c72864caab7027ea67a
HID: hid-cypress: clean up usage of 'driver_data'

The module is storing an integer inside the drvdata pointer, which is
confusing - furthermore this integer is mutable. When its value is
changed it is set again using the 'hid_set_drvdata' API within
the 'cp_event' function.

Let's fix this, create and allocate the 'cp_device' struct that is then
set as the drvdata and then simply use its integer 'quirks' field for
storing the quirks, which shall make the code cleaner, type-safe,
consistent and more readable.

This makes the cast to (void *) during storage unnecessary and the cast
to (unsigned long) during retrieval is also removed.

Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-cypress.c