public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Deborah Brouwer <deborah.brouwer@collabora.com>
Cc: dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
	 daniel.almeida@collabora.com, boris.brezillon@collabora.com,
	 broonie@kernel.org, dakr@kernel.org,
	miguel.ojeda.sandonis@gmail.com
Subject: Re: [PATCH] drm/tyr: suppress unread field warnings
Date: Thu, 22 Jan 2026 08:42:02 +0000	[thread overview]
Message-ID: <aXHi2jJNptrgUqyj@google.com> (raw)
In-Reply-To: <20260122003746.405370-1-deborah.brouwer@collabora.com>

On Wed, Jan 21, 2026 at 04:37:46PM -0800, Deborah Brouwer wrote:
> Currently these warnings, as errors, are preventing Tyr driver
> from building:
> 
> error: field `device` is never read
>   --> drivers/gpu/drm/tyr/driver.rs:37:5
>    |
> 36 | pub(crate) struct TyrDriver {
>    |                   --------- field in this struct
> 37 |     device: ARef<TyrDevice>,
>    |     ^^^^^^
>    |
>    = note: `-D dead-code` implied by `-D warnings`
>    = help: to override `-D warnings` add `#[allow(dead_code)]`
> 
> error: fields `mali` and `sram` are never read
>    --> drivers/gpu/drm/tyr/driver.rs:196:5
>     |
> 195 | struct Regulators {
>     |        ---------- fields in this struct
> 196 |     mali: Regulator<regulator::Enabled>,
>     |     ^^^^
> 197 |     sram: Regulator<regulator::Enabled>,
>     |     ^^^^
> 
> error: aborting due to 2 previous errors
> 
> Suppress these errors so that the Tyr driver will build.
> 
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>

I still don't understand why I couldn't reproduce it myself, but
assuming it's not just an 1.80.0 issue, below is my review:

>  drivers/gpu/drm/tyr/driver.rs | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
> index 2a45d0288825..04c865cb4397 100644
> --- a/drivers/gpu/drm/tyr/driver.rs
> +++ b/drivers/gpu/drm/tyr/driver.rs
> @@ -34,6 +34,7 @@
>  
>  #[pin_data(PinnedDrop)]
>  pub(crate) struct TyrDriver {
> +    #[allow(dead_code)]
>      device: ARef<TyrDevice>,

Let's use #[expect(dead_code)] so we remember to remove this when a user
is added.

>  }
>  
> @@ -193,6 +194,8 @@ struct Clocks {
>  
>  #[pin_data]
>  struct Regulators {
> +    #[allow(dead_code)]
>      mali: Regulator<regulator::Enabled>,
> +    #[allow(dead_code)]
>      sram: Regulator<regulator::Enabled>,

I don't think we intend to ever use these fields - they exist only for
their destructor. In that case, please prefix them with an underscore
instead:

#[pin_data]
struct Regulators {
    _mali: Regulator<regulator::Enabled>,
    _sram: Regulator<regulator::Enabled>,
}

Alice

  parent reply	other threads:[~2026-01-22  8:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22  0:37 [PATCH] drm/tyr: suppress unread field warnings Deborah Brouwer
2026-01-22  0:58 ` Miguel Ojeda
2026-01-22  2:11   ` Deborah Brouwer
2026-01-22 11:22   ` Mark Brown
2026-01-22 19:46     ` Danilo Krummrich
2026-01-23 15:01       ` Miguel Ojeda
2026-01-23 15:10         ` Alice Ryhl
2026-01-23 15:24           ` Miguel Ojeda
2026-01-23 16:56             ` Gary Guo
2026-01-24 13:14     ` Miguel Ojeda
2026-01-22  8:42 ` Alice Ryhl [this message]
2026-01-22 19:05   ` Deborah Brouwer
2026-01-23 12:08     ` Alice Ryhl
2026-01-22 19:32   ` Gary Guo
2026-01-23  9:18     ` Alice Ryhl
2026-01-23 13:36     ` Miguel Ojeda

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=aXHi2jJNptrgUqyj@google.com \
    --to=aliceryhl@google.com \
    --cc=boris.brezillon@collabora.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=deborah.brouwer@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /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