Re: [PATCH v2 00/12] rust: driver: use pointers instead of indices for ID info

From: Gary Guo

Date: Mon Jun 29 2026 - 08:51:20 EST


On Mon Jun 29, 2026 at 1:38 PM BST, Gary Guo wrote:
> Most C drivers use a pointer (and cast to kernel_ulong_t) for driver_data
> fields in device_id. Rust code currently does not do this, but rather use
> indices. These indices then needs to be translated to `&IdInfo` separately
> and this is by a side table.
>
> This leads to open-coded ACPI/OF handling in driver.rs, which is not
> desirable. Convert the code to use pointers (or rather, static references)
> instead.
>
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> Changes in v2:
> - Change USB to take `Option<&IdInfo>` in addition to PCI due to ability to
> dynamically add IDs.
> - Mention dyn IDs and driver_override in safety comments and justify why
> they're correct.
> - Link to v1: https://patch.msgid.link/20260618-id_info-v1-0-96af1e559ef9@xxxxxxxxxxx

Oops, this cover letter is sent by mistake. Please see the 11-patch series.

Best,
Gary