From: Guenter Roeck <linux@roeck-us.net>
To: Donjuanplatinum <donplat@barrensea.org>, ojeda@kernel.org
Cc: boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com,
lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com,
tmgross@umich.edu, dakr@kernel.org,
rust-for-linux@vger.kernel.org, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] rust: hwmon: add basic hwmon abstractions
Date: Tue, 12 May 2026 09:30:45 -0700 [thread overview]
Message-ID: <9c2fa543-525a-4e43-9f73-7caf13b98039@roeck-us.net> (raw)
In-Reply-To: <20260512155747.10136-1-donplat@barrensea.org>
On 5/12/26 08:57, Donjuanplatinum wrote:
> Add a minimal Rust abstraction for the Hardware Monitoring (hwmon)
> subsystem.
>
> Currently, this abstraction supports a Minimum Viable Product (MVP) scope:
> registering a single temperature sensor with the read-only `temp1_input`
> attribute. Support for multi-channel, additional sensor types, and
> writable attributes is deferred to future patches to keep this initial
> foundation reviewable.
>
> The primary architectural challenge in wrapping hwmon is initializing
> `struct hwmon_chip_info`, which requires stable, self-referential
> pointers to nested NULL-terminated arrays. Instead of relying on complex
> macro generation for static allocation, this implementation leverages
> a single heap allocation (`KBox`). It safely wires the self-referential
> raw pointers using unaliased `&raw mut` during the allocation's
> exclusive ownership phase, and then securely seals it by pinning
> (`Pin::new_unchecked`).
>
> For resource management, this implementation uses standard Rust RAII
> (calling `hwmon_device_unregister` in `Drop`) rather than `devm_`
> variants, ensuring natural drop ordering and avoiding complex C-side
> trampolines for generic types.
>
> Signed-off-by: Donjuanplatinum <donplat@barrensea.org>
Sorry, rust support in the hardware monitoring subsystem will have to wait
for someone else to pick up maintainership.
Guenter
next prev parent reply other threads:[~2026-05-12 16:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 15:57 Donjuanplatinum
2026-05-12 16:30 ` Guenter Roeck [this message]
2026-10-16 7:24 ` [PATCH 0/2] rust: hwmon: rework hwmon abstractions, add TMP108 driver skxby
2026-10-16 8:11 ` Donjuanplatinum
[not found] ` <179214016501.15268.642738678844764524@qq.com>
2026-10-16 8:42 ` skxby
2026-10-16 16:16 ` Guenter Roeck
2026-10-17 1:38 ` skxby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9c2fa543-525a-4e43-9f73-7caf13b98039@roeck-us.net \
--to=linux@roeck-us.net \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=donplat@barrensea.org \
--cc=gary@garyguo.net \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®