mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rust: io: fix unused Flags::from_raw warning without CONFIG_PCI
@ 2026-10-26  3:53 Eliot Courtney
  2026-10-26  4:55 ` Alexandre Courbot
  0 siblings, 1 reply; 2+ messages in thread
From: Eliot Courtney @ 2026-10-26  3:53 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, Daniel Almeida, Miguel Ojeda,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Tamir Duberstein,
	Onur Özkan
  Cc: John Hubbard, Alistair Popple, Timur Tabi, Alexandre Courbot,
	driver-core, rust-for-linux, linux-kernel, kernel test robot,
	Eliot Courtney

Currently, `Flags::from_raw()` is only used by
`pci::Device::resource_flags()`, so rustc errors (with CONFIG_WERROR)
saying that it is never used when `CONFIG_PCI` is disabled.

    error: associated function `from_raw` is never used
       --> rust/kernel/io/resource.rs:240:25

`Resource::flags()` also converts the raw `flags` field to `Flags` and is
built in every config, so the easiest way to get rid of this error is
to just use it there too.

Fixes: 3f1e12fce16f ("rust: pci: add resource_flags accessor")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/all/20261023154005.95904-1-ojeda@kernel.org/
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610241133.L9VWoFcD-lkp@intel.com/
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
 rust/kernel/io/resource.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/io/resource.rs b/rust/kernel/io/resource.rs
index 758ce62b3cce..29771355cfce 100644
--- a/rust/kernel/io/resource.rs
+++ b/rust/kernel/io/resource.rs
@@ -164,7 +164,7 @@ pub fn flags(&self) -> Flags {
         // SAFETY: Safe as per the invariants of `Resource`.
         let flags = unsafe { (*inner).flags };
 
-        Flags(flags)
+        Flags::from_raw(flags)
     }
 }
 

---
base-commit: 21a7f44fd0765fcc5194130b28767786eba1d1e7
change-id: 20261026-pci-fix-5ac8d9f642c7

Best regards,
--  
Eliot Courtney <ecourtney@nvidia.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-26  4:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26  3:53 [PATCH] rust: io: fix unused Flags::from_raw warning without CONFIG_PCI Eliot Courtney
2026-10-26  4:55 ` Alexandre Courbot

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®