Re: [PATCH v1 0/9] HID: Make driver_data in hid_device_id a union
From: Uwe Kleine-König
Date: Sat Nov 28 2026 - 17:25:06 EST
Hello Guenter,
On Sat, Nov 28, 2026 at 10:50:45AM -0800, Guenter Roeck wrote:
> 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).
I think pointers for HID devices are a tad uglier compared to other
devices because you can set driver_data using the new_id mechanism. But
I think that's the fault of new_id and I'd consider throwing that out.
(Though Pawel's patch idea to only accept driver data values that
already exist decreases the danger by a big margin. And then pointers
are not worse than enums/integers.)
> > [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.
I didn't check Pawel's series, but mine has
drivers/hid/hid-steelseries-arctis.c | 39 ++-
in the diffstat.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature