Skip to content

Commit 5f894b9

Browse files
committed
rust: i2c: add of support
Signed-off-by: Fabien Parent <[email protected]>
1 parent 7581a40 commit 5f894b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rust/kernel/i2c.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
device::RawDevice,
1010
driver::{self, RawDeviceId},
1111
error::{from_result, to_result, Result},
12+
of,
1213
str::{BStr, CStr},
1314
types::ForeignOwnable,
1415
ThisModule,
@@ -106,6 +107,9 @@ impl<T: Driver> driver::DriverOps for Adapter<T> {
106107
if let Some(t) = T::I2C_DEVICE_ID_TABLE {
107108
i2cdrv.id_table = t.as_ref();
108109
}
110+
if let Some(t) = T::OF_DEVICE_ID_TABLE {
111+
i2cdrv.driver.of_match_table = t.as_ref();
112+
}
109113

110114
// SAFETY:
111115
// - `pdrv` lives at least until the call to `platform_driver_unregister()` returns.
@@ -169,6 +173,9 @@ pub trait Driver {
169173
/// The table of device ids supported by the driver.
170174
const I2C_DEVICE_ID_TABLE: Option<driver::IdTable<'static, DeviceId, Self::IdInfo>> = None;
171175

176+
/// The table of device ids supported by the driver.
177+
const OF_DEVICE_ID_TABLE: Option<driver::IdTable<'static, of::DeviceId, Self::IdInfo>> = None;
178+
172179
/// I2C driver probe.
173180
///
174181
/// Called when a new i2c client is added or discovered.

0 commit comments

Comments
 (0)