From: Daniel Almeida <daniel.almeida@collabora.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v14 2/3] rust: io: mem: add a generic iomem abstraction
Date: Wed, 16 Jul 2025 18:52:54 -0300 [thread overview]
Message-ID: <8A8152BD-A314-4A23-B104-AD802F7E2DB6@collabora.com> (raw)
In-Reply-To: <20250716-topics-tyr-platform_iomem-v14-2-2c2709135cb2@collabora.com>
Hi,
[…]
> +
> +/// An exclusive memory-mapped IO region.
> +///
> +/// # Invariants
> +///
> +/// - [`ExclusiveIoMem`] has exclusive access to the underlying [`IoMem`].
> +pub struct ExclusiveIoMem<const SIZE: usize> {
> + /// The underlying `IoMem` instance.
> + iomem: IoMem<SIZE>,
> +
> + /// The region abstraction. This represents exclusive access to the
> + /// range represented by the underlying `iomem`.
> + ///
> + /// This field is needed for ownership of the region.
> + _region: Region,
> +}
> +
> +impl<const SIZE: usize> ExclusiveIoMem<SIZE> {
> + /// Creates a new `ExclusiveIoMem` instance.
> + fn ioremap(resource: &Resource) -> Result<Self> {
> + let start = resource.start();
> + let size = resource.size();
> + let name = resource.name().ok_or(EINVAL)?;
Note the change above. If there’s no name, we fail.
I just noticed that this may not be the right approach, but OTOH we should note that
“not having a name” is apparently considered a bug in the C code under some
circumstances:
struct resource *r = v, *p;
[…]
seq_printf(m, "%*s%0*llx-%0*llx : %s\n",
depth * 2, "",
width, start,
width, end,
r->name ? r->name : "<BAD>”); <—————
— Daniel
next prev parent reply other threads:[~2025-07-16 21:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 21:45 [PATCH v14 0/3] rust: platform: add Io support Daniel Almeida
2025-07-16 21:45 ` [PATCH v14 1/3] rust: io: add resource abstraction Daniel Almeida
2025-07-16 21:45 ` [PATCH v14 2/3] rust: io: mem: add a generic iomem abstraction Daniel Almeida
2025-07-16 21:52 ` Daniel Almeida [this message]
2025-07-16 22:26 ` Danilo Krummrich
2025-07-16 21:45 ` [PATCH v14 3/3] rust: platform: add resource accessors Daniel Almeida
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=8A8152BD-A314-4A23-B104-AD802F7E2DB6@collabora.com \
--to=daniel.almeida@collabora.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@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®