From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6F352C0279; Thu, 9 Oct 2025 12:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760011711; cv=none; b=i5hqahTPJ18fXmDIuN40VGkqgWpHUbwt1MPC6Xd7k857T8dgHdMSmApeyFT1USfNfhelehZihRdNkELku4sCNTszzxl990qHm/L1+51TUiy72WS4AeyAJEjReLBqmM+fVQFiwCfFhJ4ib73IgzyPkZiG/iwjxmwovy/pQ0r6LAM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760011711; c=relaxed/simple; bh=iYWXzbx8ez66kA8heLRQ8QJs3w96QVpJOS9TtjkvoUQ=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=VPhcX7a+f0x7CB4Zr0K85NDtO3OhxbkRhqncJHOzZaOUEKASTL+4IS1HjH2AO0NHj2iR0rP/4d8zF22A3MCti5YTPxsYUdoLg4y9m0oJ3QhkfxmIdfpQyi1ODvFoMyDLfo35t/nMdS7qTYJKq//y16t+PtSFLOUNpNcVEoW0TWM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IriN6iQ8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IriN6iQ8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54674C4CEE7; Thu, 9 Oct 2025 12:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760011710; bh=iYWXzbx8ez66kA8heLRQ8QJs3w96QVpJOS9TtjkvoUQ=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=IriN6iQ84HhmieUK0DFkuVAA/LEd/dIdBS3Zu3zVrizkKWDA9PujxosO4S9sttq/m LlM43ya970fVq9vkIjns9CMPbLJYvVrbSVvjNsTEz0ShWm7VnIlLjWxyI1+ZSI8h51 EaP4ScD2LKPW0rTefggsjnauQ0kCeK8z2nlbEc5B5YY/Vm/dQuNt5BQ84V8RlMZ1lJ Bm8URkhQMYrQ7CXLLQWVUpHT0B3GUaOty8FdYklFajNsMcA/yIwNLRsiqSuQ/EZGKg RQKxgUDX2QzUoTmuAf8VrJ91P55Ew0RRKBqNFh+qL8bp3g4V9HljAM+5KAZx0ZUxMB d2u0dcGHgyunQ== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 09 Oct 2025 14:08:24 +0200 Message-Id: Subject: Re: [PATCH 1/4] rust: i2c: add read and write byte data abstractions Cc: "Lee Jones" , "Pavel Machek" , "Miguel Ojeda" , "Alex Gaynor" , "Igor Korotin" , "Lorenzo Stoakes" , "Vlastimil Babka" , "Liam R. Howlett" , "Uladzislau Rezki" , "Boqun Feng" , "Gary Guo" , , "Benno Lossin" , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Daniel Almeida" , , , To: "Markus Probst" From: "Danilo Krummrich" References: <20251008181027.662616-1-markus.probst@posteo.de> <20251008181027.662616-2-markus.probst@posteo.de> In-Reply-To: <20251008181027.662616-2-markus.probst@posteo.de> On Wed Oct 8, 2025 at 8:10 PM CEST, Markus Probst wrote: > In addition to the core abstractions, implement > > * `i2c::I2cClient::read_byte` - read a byte from the i2c client > * `i2c::I2cClient::write_byte` - write a byte to the i2c client > > * `i2c::I2cClient::read_byte_data` - read byte data from the i2c client > * `i2c::I2cClient::write_byte_data` - write byte data to the i2c client > > * `i2c::I2cClient::read_word_data` - read word data from the i2c client > * `i2c::I2cClient::write_word_data` - write word data to the i2c client I don't think those should be implemented to be used by drivers directly. Instead we should generalize the Io type [1] and allow for arbitrary backen= ds, such that we can use the register!() macro [2] to define register types for= I2C devices. Ideally, an I2C / SMBus backend should use regmap right away. The register!() macro is currently moved into the generic infrastructure [3= ]. [1] https://rust.docs.kernel.org/kernel/io/struct.Io.html [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /drivers/gpu/nova-core/regs/macros.rs [3] https://lore.kernel.org/all/20251003154748.1687160-1-joelagnelf@nvidia.= com/