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