[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260128182925.13225-1-linkmauve@linkmauve.fr>
Date: Wed, 28 Jan 2026 19:29:19 +0100
From: Link Mauve <linkmauve@...kmauve.fr>
To: rust-for-linux@...r.kernel.org
Cc: Link Mauve <linkmauve@...kmauve.fr>,
Srinivas Kandagatla <srini@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>,
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>,
Danilo Krummrich <dakr@...nel.org>,
Daniel Almeida <daniel.almeida@...labora.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Lyude Paul <lyude@...hat.com>,
Asahi Lina <lina+kernel@...hilina.net>,
Viresh Kumar <viresh.kumar@...aro.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Tamir Duberstein <tamird@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 0/3] Add Rust abstractions for nvmem-provider
Hi, this is my first foray in Rust in the kernel! I’m fairly used to
both Rust and the kernel, but not yet to both at the same time.
I wanted to try something simple before jumping to more advanced stuff
like DRM or V4L2 drivers, so I set on rewriting one of my old Wii
drivers in Rust. So far I have only tested that the nvmem abstraction
and the driver compile, but haven’t tested it on an actual Wii, hence
the RFC.
I made sure there was no unsafe anywhere in the driver, and tried to
keep it to as few places as possible in the nvmem abstraction. I still
have issues with the mutability of the NvmemProvider::Priv type, so for
now I’ve made it a simple reference but I believe this won’t work in the
long run (or even in the short run). I’ll take any idea for how to fix
that.
So, comments welcome! :)
Link Mauve (3):
nvmem: Document enum nvmem_type and its variants
rust: nvmem: Add an abstraction for nvmem providers
nvmem: Replace the Wii and Wii U OTP driver with a Rust one
drivers/nvmem/Makefile | 2 +-
drivers/nvmem/nintendo-otp.c | 122 -------------------------
drivers/nvmem/nintendo_otp.rs | 137 ++++++++++++++++++++++++++++
include/linux/nvmem-provider.h | 8 ++
rust/bindings/bindings_helper.h | 1 +
rust/kernel/lib.rs | 2 +
rust/kernel/nvmem.rs | 155 ++++++++++++++++++++++++++++++++
7 files changed, 304 insertions(+), 123 deletions(-)
delete mode 100644 drivers/nvmem/nintendo-otp.c
create mode 100644 drivers/nvmem/nintendo_otp.rs
create mode 100644 rust/kernel/nvmem.rs
--
2.52.0
Powered by blists - more mailing lists