From: Danilo Krummrich <dakr@kernel.org>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@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" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@lists.linux.dev
Subject: Re: [PATCH v2] rust: device: allow `Device<DeviceContext>::parent()`
Date: Tue, 29 Apr 2025 23:52:32 +0200 [thread overview]
Message-ID: <aBFKII5I7R2piEcA@pollux> (raw)
In-Reply-To: <20250429210629.513521-1-ojeda@kernel.org>
On Tue, Apr 29, 2025 at 11:06:29PM +0200, Miguel Ojeda wrote:
> When `CONFIG_AUXILIARY_BUS` is disabled, `parent()` is still dead code:
>
> error: method `parent` is never used
> --> rust/kernel/device.rs:71:19
> |
> 64 | impl<Ctx: DeviceContext> Device<Ctx> {
> | ------------------------------------ method in this implementation
> ...
> 71 | pub(crate) fn parent(&self) -> Option<&Self> {
> | ^^^^^^
> |
> = note: `-D dead-code` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(dead_code)]`
>
> Thus reintroduce the `expect`, but now as a conditional one. Do so as
> `dead_code` since that is narrower.
>
> An `allow` would also be possible, but Danilo wants to catch new users
> in the future [1].
>
> Link: https://lore.kernel.org/rust-for-linux/aBE8qQrpXOfru_K3@pollux/ [1]
> Fixes: ce735e73dd59 ("rust: auxiliary: add auxiliary device / driver abstractions")
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Applied to nova-next, thanks!
[ Adjust commit subject to "rust: device: conditionally expect
`dead_code` for `parent()`". - Danilo ]
prev parent reply other threads:[~2025-04-29 21:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 21:06 [PATCH v2] rust: device: allow `Device<DeviceContext>::parent()` Miguel Ojeda
2025-04-29 21:20 ` Miguel Ojeda
2025-04-29 21:52 ` Danilo Krummrich [this message]
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=aBFKII5I7R2piEcA@pollux \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=patches@lists.linux.dev \
--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