lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f65c9cc0-318a-4c0a-9d0c-9c1a3d58d2b9@gmail.com>
Date: Sat, 27 Sep 2025 17:43:43 +0100
From: Igor Korotin <igor.korotin.linux@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
 Wolfram Sang <wsa+renesas@...g-engineering.com>,
 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>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Viresh Kumar <viresh.kumar@...aro.org>,
 Asahi Lina <lina+kernel@...hilina.net>,
 Wedson Almeida Filho <wedsonaf@...il.com>, Alex Hung <alex.hung@....com>,
 Tamir Duberstein <tamird@...il.com>,
 Xiangfei Ding <dingxiangfei2009@...il.com>, linux-kernel@...r.kernel.org,
 rust-for-linux@...r.kernel.org, linux-i2c@...r.kernel.org
Subject: Re: [PATCH v5 2/3] rust: i2c: add manual I2C device creation
 abstractions

Hello Danilo

On 9/11/2025 9:34 PM, Danilo Krummrich wrote:
> On Thu Sep 11, 2025 at 5:50 PM CEST, Igor Korotin wrote:
>> +impl I2cAdapter {
>> +    /// Gets pointer to an `i2c_adapter` by index.
>> +    pub fn get(index: i32) -> Result<ARef<Self>> {
> 
> Where do we get this index usually from? OF, ACPI, etc. I assume? I feel like it
> could make sense to wrap it into a new type. Even though it is not safety
> relevant it eliminates a source for mistakes.

It usually comes as predefined magic number in a platform driver info.
I'll define a specific type for this number for clearance.

>> +    }
>> +}
>> +
>> +impl<Ctx: device::DeviceContext> AsRef<I2cAdapter<Ctx>> for I2cAdapter<Ctx> {
>> +    fn as_ref(&self) -> &I2cAdapter<Ctx> {
>> +        &self
>> +    }
>> +}
> 
> This AsRef implementation doesn't seem to do anything?

I misunderstood the concept of the ARef<T> a little bit and used this 
as_ref() instead of just getting a reference by &adapter. I'll remove 
this in the next drop

Thanks for the review. All other comments are noted. I'll address them 
in the next drop as well

Cheers
Igor

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ