Re: [PATCH v1 0/9] HID: Make driver_data in hid_device_id a union
From: Guenter Roeck
Date: Sat Nov 28 2026 - 13:50:59 EST
Hi,
On 11/25/26 06:23, Pawel Zalewski wrote:
For the record I did attempt this in the past [1], this approach was
rejected and a series which changes driver_data to be always an
integer was created instead [2]. However, I personally much prefer the
anonymous union approach, given that it will already be the case in
other subsystems. The HID subsystem doesn't need to go its own way and
the alternative is slightly uglier in practice (as you end up looking
up from tables via an index).
[1] https://lore.kernel.org/linux-input/20260518-mod-devicetable-hid_device_id-v1-0-a08e3989c283@xxxxxxxxxxxxxxxxxxxx/
[2] https://lore.kernel.org/linux-input/20260727-mod-devicetable-hid_device_id-v3-0-980896ca283e@xxxxxxxxxxxxxxxxxxxx/
Reviewed-by: Pawel Zalewski <pzalewski@xxxxxxxxxxxxxxxxxxxx>
I don't know what happened with that series, but it does miss
at least the hwmon driver which also uses driver_data as pointer
(patch 5/9 of this series). Personally I don't really care which
approach is used, though I do content the notion that using
driver_data as pointer would be an "offender" (unless one declares
that the Linux kernel would have more than 500 such "offenders".
On as side note, unless I am missing something, it seems to me that
both series above might miss drivers/hid/hid-steelseries-arctis.c,
though possibly I misunderstand the code.
Thanks,
Guenter