[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4b6d9f389862aa4d2c43394cdacde059c4cbba5e.camel@posteo.de>
Date: Sat, 31 Jan 2026 14:28:43 +0000
From: Markus Probst <markus.probst@...teo.de>
To: igor.korotin.linux@...il.com, Danilo Krummrich <dakr@...nel.org>, Daniel
Almeida <daniel.almeida@...labora.com>, Miguel Ojeda <ojeda@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno
Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-i2c@...r.kernel.org
Subject: Re: [PATCH 4/5] rust: i2c: add I2C wrappers
On Sat, 2026-01-31 at 14:12 +0000, Igor Korotin via B4 Relay wrote:
> From: Igor Korotin <igor.korotin.linux@...il.com>
>
> Add safe Rust wrappers for common I2C/SMbus operations on I2C clients.
>
> These wrappers provide safe abstractions over low-level C API calls:
> - SMbus byte operations: read/write byte and byte data
> - SMbus word operations: read/write word data
> - SMbus block operations: read/write I2C block data
> - Master I2C operations: master receive and master send
>
> All operations include proper error handling through the Result type.
>
> Signed-off-by: Igor Korotin <igor.korotin.linux@...il.com>
> ---
> rust/helpers/helpers.c | 1 +
> rust/helpers/i2c.c | 15 ++++++++
> rust/kernel/i2c/client.rs | 92 +++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 108 insertions(+)
>
I think I2CClient should implement the IO [1] trait instead, as
suggested by Danilo [2].
Also I think it is a little odd that read and write is possible, on
I2CClient<Normal> and not I2CClient<Bound>. Shouldn't the assigned
driver have exclusive read and write access to the device?
Thanks
- Markus Probst
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git/commit/?h=driver-core-testing&id=121d87b28e1d9061d3aaa156c43a627d3cb5e620
[2]
https://lore.kernel.org/rust-for-linux/DDDS2V0V2NVJ.16ZKXCKUA1HUV@kernel.org/
Download attachment "signature.asc" of type "application/pgp-signature" (871 bytes)
Powered by blists - more mailing lists