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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCQ92VZ22KOU.14L0I1QBKBT29@kernel.org>
Date: Thu, 11 Sep 2025 22:23:46 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Igor Korotin" <igor.korotin.linux@...il.com>
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 1/3] rust: i2c: add basic I2C device and driver
 abstractions

On Thu Sep 11, 2025 at 5:49 PM CEST, Igor Korotin wrote:
> +pub trait Driver: Send {
> +    /// The type holding information about each device id supported by the driver.
> +    // TODO: Use `associated_type_defaults` once stabilized:
> +    //
> +    // ```
> +    // type IdInfo: 'static = ();
> +    // ```
> +    type IdInfo: 'static;
> +
> +    /// The table of device ids supported by the driver.
> +    const I2C_ID_TABLE: Option<IdTable<Self::IdInfo>> = None;
> +
> +    /// The table of OF device ids supported by the driver.
> +    const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None;
> +
> +    /// The table of ACPI device ids supported by the driver.
> +    const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None;
> +
> +    /// I2C driver probe.
> +    ///
> +    /// Called when a new i2c client is added or discovered.
> +    /// Implementers should attempt to initialize the client here.
> +    fn probe(
> +        dev: &I2cClient<device::Core>,
> +        id_info: Option<&Self::IdInfo>,
> +    ) -> Result<Pin<KBox<Self>>>;
> +
> +    /// I2C driver shutdown
> +    ///
> +    /// Called when

Seems like you did forget to actually finish the comment.

> +    fn shutdown(dev: &I2cClient<device::Core>) {

You should also provide a Pin<&Self> argument.

> +        let _ = dev;
> +    }

Can you please also add an unbind() method analogous to PCI, platform, etc.? It
avoids that people have to use try_access() for accessing device resources on
remove().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ