All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Andrew Davis" <afd@ti.com>,
	"Igor Korotin" <igor.korotin@linux.dev>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "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>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>
Cc: <rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v2] rust: i2c: Remove use of bindings::i2c_match_id
Date: Tue, 17 Nov 2026 11:37:19 +0000	[thread overview]
Message-ID: <DMXGF5NG8WYB.188PXG822AN59@garyguo.net> (raw)
In-Reply-To: <20261111231053.529616-1-afd@ti.com>

On Wed Nov 11, 2026 at 11:10 PM GMT, Andrew Davis wrote:
> The C function i2c_match_id() is slated for removal, remove use of this
> from Rust I2C by switching to bindings::i2c_get_match_data().
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>
> Well Sashiko suggested I take the easy way and just re-use a different C
> function instead of trying to open-code the loop in Rust. The C function
> implements the same lookup as i2c_id_info did so we can drop that out and
> its i2c_id_table helper. Still would like some help on checking if this
> is actually correct though..

We historically use open-coded matching in Rust as integer indices are used
instead of pointers, but we have cleaned it up since
https://lore.kernel.org/driver-core/20260629-id_info-v2-0-56fccbe9c5ef@garyguo.net
So open-coded logic should be all removable now.

Reviewed-by: Gary Guo <gary@garyguo.net>

>
> Thanks,
> Andrew
>
>  rust/kernel/i2c.rs | 39 +++++++--------------------------------
>  1 file changed, 7 insertions(+), 32 deletions(-)


  parent reply	other threads:[~2026-11-17 11:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 20:52 [RFC PATCH] rust: i2c: Remove use of bindings::i2c_match_id Andrew Davis
2026-11-11 23:10 ` [RFC PATCH v2] " Andrew Davis
2026-11-16 18:25   ` Miguel Ojeda
2026-11-17  1:40     ` Andrew Davis
2026-11-17 11:37   ` Gary Guo [this message]
2026-11-18 16:44 ` [PATCH] " Andrew Davis
2026-11-21 20:38   ` Igor Korotin

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=DMXGF5NG8WYB.188PXG822AN59@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=afd@ti.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=igor.korotin@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.