[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=vWNZ_y_5R45Kd6KrnBwfd55bh8yAqxtvZcVrrHr5eWA@mail.gmail.com>
Date: Tue, 29 Apr 2025 23:20:18 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v2] rust: device: allow `Device<DeviceContext>::parent()`
On Tue, Apr 29, 2025 at 11:06 PM Miguel Ojeda <ojeda@...nel.org> 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@...nel.org>
Great, I updated this message and somehow broke the title completely
-- please assume it was:
rust: device: conditionally expect `dead_code` for
`Device<DeviceContext>::parent()`
And, again, please feel free to just `fixup` this patch if preferred.
Cheers,
Miguel
Powered by blists - more mailing lists