public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Korotin <igor.korotin@linux.dev>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Markus Probst" <markus.probst@posteo.de>,
	igor.korotin.linux@gmail.com,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH 4/5] rust: i2c: add I2C wrappers
Date: Sun, 8 Feb 2026 12:44:53 +0000	[thread overview]
Message-ID: <00b38d6a-a334-4e9b-b8ae-172f3ea16cb1@linux.dev> (raw)
In-Reply-To: <DG6C66CP0EB4.25ZLDO70LFB7K@kernel.org>

Hello Danilo

On 2/4/2026 4:59 PM, Danilo Krummrich wrote:
> On Wed Feb 4, 2026 at 5:49 PM CET, Igor Korotin wrote:
>> I'm not sure it is appropriate to use IO and register! here. I2C devices
>> are different. Not all of them use register like access. For example
>> EEPROM I2C devices allow random read/write operations inside their
>> address space. After all I2C doesn't implement the same way of accessing
>> its memory space as for example PCI devices.
> 
> Conceptually, it is not different, it is some device memory connected through
> some bus.
> 
> Memory mapped I/O allows "random read/write operations" as well, see
> memcpy_fromio() and memcpy_toio().
> 
> The same thing is true for DMA memory. While it's not owned by the device, it's
> still shared with a device.
> 
> Gary just started working on a generic IoView<'io, T> type which will serve as a
> general abstraction to interact with any kind of memory that is shared between a
> device and the CPU [1].
> 
> So, for I2C this would mean that if you have register like accesses you can use
> the register!() abstractions. If you want random read/write operations, you can
> use IoView to copy from / to system memory or even to a user buffer directly.
> 
> Of course you can also still use Io::read32() and friends.
> 
> [1] https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/with/571786051

thanks, that makes sense.

I don’t have a strong prior opinion on how this should look yet, so I’m 
fine aligning the I2C abstractions with the generic direction you 
describe. Using register!() for register-like accesses and IoView for 
more general read/write patterns seems reasonable.

At this point I’ll treat this as the intended model and adjust the I2C 
side accordingly once IoView is in place and its API settles.

Regards,
Igor

  reply	other threads:[~2026-02-08 12:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-31 14:12 [PATCH 0/5] rust: extend I2C functionality Igor Korotin via B4 Relay
2026-01-31 14:12 ` [PATCH 1/5] rust: i2c: split client and adapter code into separate files Igor Korotin via B4 Relay
2026-01-31 14:12 ` [PATCH 2/5] rust: bits: add define_flags macro Igor Korotin via B4 Relay
2026-02-08 13:56   ` Daniel Almeida
2026-01-31 14:12 ` [PATCH 3/5] rust: i2c: Add I2C Adapter registration abstractions Igor Korotin via B4 Relay
2026-01-31 14:12 ` [PATCH 4/5] rust: i2c: add I2C wrappers Igor Korotin via B4 Relay
2026-01-31 14:28   ` Markus Probst
2026-02-04 16:49     ` Igor Korotin
2026-02-04 16:59       ` Danilo Krummrich
2026-02-08 12:44         ` Igor Korotin [this message]
2026-02-04 17:03       ` Danilo Krummrich
2026-01-31 14:12 ` [PATCH 5/5] samples: rust: add Rust I2C adapter registration sample Igor Korotin via B4 Relay
2026-01-31 14:26 ` [PATCH 0/5] rust: extend I2C functionality Danilo Krummrich
2026-02-08 12:34   ` Igor Korotin
2026-02-08 17:07     ` Danilo Krummrich
2026-02-09 11:31   ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00b38d6a-a334-4e9b-b8ae-172f3ea16cb1@linux.dev \
    --to=igor.korotin@linux.dev \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=igor.korotin.linux@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=markus.probst@posteo.de \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox