History

rust: driver: remove open-coded matching logic

With device ID info now including pointers instead of indices, the open-coded ACPI/OF matching is no longer needed and can be replaced with `device_get_match_data`. With the removal of open-coded matching, the exposed functions and helpers are also removed; this effectively reverts most of commit 2690d071584e ("rust: ACPI: fix missing match data for PRP0001").

Gary Guo committed 4 months ago

Commit 2c5d17c1 parent 0b763359 files · +22 −162Browse files

Showing the changes to rust/kernel/serdev.rs (1 of 9 files). Show all

Unified · Split

rust/kernel/serdev.rs+2−1
@@ -162,7 +162,8 @@ impl<T: Driver> Adapter<T> { · 161 unmodified lines
162162 //
163163 // INVARIANT: `sdev` is valid for the duration of `probe_callback()`.
164164 let sdev = unsafe { &*sdev.cast::<Device<device::CoreInternal<'_>>>() };
165− let info = <Self as driver::Adapter>::id_info(sdev.as_ref());
165+ // SAFETY: `sdev` matched data is of type `Self::IdInfo`.
166+ let info = unsafe { <Self as driver::Adapter>::id_info(sdev.as_ref()) };
166167
167168 from_result(|| {
168169 sdev.as_ref().set_drvdata(try_pin_init!(PrivateData::<T> {