Skip to content

rust: driver: use pointers instead of indices for ID info

Gary Guo dri-devel driver-core linux-acpi linux-devicetree linux-pci linux-pm linux-pwm linux-usb lkml netdev nova-gpu rust-for-linux 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20260612-id_info-23eca472ccd8

Versions newest first

  1. v2 Latest posting 2/211 patches 9 repliesApplied
  2. v2 posting 1/20 of 12 patches 1 replySuperseded
  3. v110 patches 1 replySuperseded

Changes in v2 from the cover letter

- 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/[email protected]

Patches in v2 posting 2/2 Applied

#Subject and filesSizeRepliesApplied
1/11rust: driver: remove `IdTable::id`rust/kernel/device_id.rs+0 -70 replies
2/11rust: driver: simplify `IdArray::new_without_index`rust/kernel/device_id.rs rust/kernel/net/phy.rs+28 -380 replies
3/11rust: pci: use `Option<&IdInfo>` for device ID infodrivers/gpu/nova-core/driver.rs rust/kernel/pci.rs samples/rust/rust_dma.rs +2 more+8 -70 replies
4/11rust: usb: use `Option<&IdInfo>` for device ID inforust/kernel/usb.rs samples/rust/rust_driver_usb.rs+4 -40 replies
5/11rust: net/phy: remove expansion from docrust/kernel/net/phy.rs+0 -563 replies
6/11rust: driver: centralize device ID handlingrust/kernel/acpi.rs rust/kernel/auxiliary.rs rust/kernel/device_id.rs +5 more+46 -550 replies
7/11rust: driver: remove `$module_table_name` from `module_device_table`drivers/cpufreq/rcpufreq_dt.rs drivers/gpu/drm/nova/driver.rs drivers/gpu/drm/tyr/driver.rs +17 more+17 -420 replies
8/11rust: driver: store pointers in `DeviceId`rust/kernel/acpi.rs rust/kernel/auxiliary.rs rust/kernel/device_id.rs +5 more+77 -710 replies
9/11rust: driver: remove open-coded matching logicMAINTAINERS drivers/acpi/bus.c include/acpi/acpi_bus.h +5 more+20 -1610 replies
10/11rust: driver: remove duplicate ID tablerust/kernel/device_id.rs+27 -490 replies
11/11RFC: rust: driver: support map-like syntax for ID tablerust/kernel/device_id.rs samples/rust/rust_driver_pci.rs+14 -41 reply

Reviews trailers per patch

1 of 11 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGreg Kroah-HartmanFUJITA Tomonori
SeriesR-b
1/11
2/11
3/11
4/11
5/11A-b
6/11
7/11
8/11
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/11] rust: driver: use pointers instead of indices for ID info

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.

---
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/[email protected]

---
Gary Guo (11):
rust: driver: remove IdTable::id
rust: driver: simplify IdArray::new_without_index
rust: pci: use Option<&IdInfo> for device ID info
rust: usb: use Option<&IdInfo> for device ID info
rust: net/phy: remove expansion from doc
rust: driver: centralize device ID handling
rust: driver: remove $module_table_name from module_device_table
rust: driver: store pointers in DeviceId
rust: driver: remove open-coded matching logic
rust: driver: remove duplicate ID table
RFC: rust: driver: support map-like syntax for ID table

 MAINTAINERS                           |   1 -
 drivers/acpi/bus.c                    |   6 +-
 drivers/cpufreq/rcpufreq_dt.rs        |   1 -
 drivers/gpu/drm/nova/driver.rs        |   1 -
 drivers/gpu/drm/tyr/driver.rs         |   1 -
 drivers/gpu/nova-core/driver.rs       |   3 +-
 drivers/pwm/pwm_th1520.rs             |   1 -
 include/acpi/acpi_bus.h               |  11 --
 rust/helpers/acpi.c                   |  16 ---
 rust/helpers/helpers.c                |   1 -
 rust/kernel/acpi.rs                   |  14 +--
 rust/kernel/auxiliary.rs              |  18 +--
 rust/kernel/device_id.rs              | 207 +++++++++++++++++++---------------
 rust/kernel/driver.rs                 | 137 ++--------------------
 rust/kernel/i2c.rs                    |  26 ++---
 rust/kernel/net/phy.rs                |  66 +----------
 rust/kernel/of.rs                     |  14 +--
 rust/kernel/pci.rs                    |  25 ++--
 rust/kernel/platform.rs               |   5 +-
 rust/kernel/usb.rs                    |  24 ++--
 samples/rust/rust_debugfs.rs          |   1 -
 samples/rust/rust_dma.rs              |   3 +-
 samples/rust/rust_driver_auxiliary.rs |   4 +-
 samples/rust/rust_driver_i2c.rs       |   3 -
 samples/rust/rust_driver_pci.rs       |  11 +-
 samples/rust/rust_driver_platform.rs  |   2 -
 samples/rust/rust_driver_usb.rs       |   3 +-
 samples/rust/rust_i2c_client.rs       |   2 -
 samples/rust/rust_soc.rs              |   2 -
 29 files changed, 178 insertions(+), 431 deletions(-)

---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260612-id_info-23eca472ccd8

Best regards,

Signature · 1 line
Gary Guo <[email protected]>