Re: [PATCH] rust: ACPI: fix missing match data for PRP0001

Gary Guo
2026-04-04T22:08:27Z

On Sat Apr 4, 2026 at 10:33 PM BST, Markus Probst wrote:
> On Sat, 2026-04-04 at 22:23 +0100, Gary Guo wrote:
>> BTW, if most drivers use driver_data of ID as pointers, why is it defined as
>> kernel_ulong_t instead of just `void*`?
>
> The return type of `device_get_match_data` is `const void *`.
> `of_device_id->data` has type `const void *`.
> `acpi_device_id->driver_data` and `pci_device_id->driver_data` has type
> kernel_ulong_t.
>
> Kernel doc of pci_device_id:
> "
> Data private to the driver.
> Most drivers don't need to use driver_data field.
> Best practice is to use driver_data as an index
> into a static list of equivalent device types,
> instead of using it as a pointer.
> "
> suggests it was intended for use as index in the first place.
>
> Thanks
> - Markus Probst

I would have believed it if I haven't seen a huge number of drivers just using
pointers and do a cast :)
of_device_id/dmi_system_id is also just using void* for its driver_data.

I mean, blaming through git history it looks like this documentation predates
git, so I'm not really sure how relevant this still is.

Best,
Gary