Skip to contentSkip to conversation

rust: io: fix unused Flags::from_raw warning without CONFIG_PCI

PATCH Applied Eliot Courtney 3 participants 3 messages Oct 26 – Nov 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rust: io: fix unused Flags::from_raw warning without CONFIG_PCI

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.

---
 rust/kernel/io/resource.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/io/resource.rs +1 -1
index 758ce62b3cce..29771355cfce 100644
@@ -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,

Signature · 1 line
Eliot Courtney <[email protected]>
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · 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.

Quoted 6 lines
maintainer Applied
#2 lore raw
In reply to Eliot Courtney
Quoted 1 line · Eliot Courtney

[PATCH] rust: io: fix unused Flags::from_raw warning without CONFIG_PCI

Applied, thanks!

Branch: driver-core-linus
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/1] rust: io: fix unused Flags::from_raw warning without CONFIG_PCI

      commit: 14098e496671

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is queued up for Linus's tree and should land in the next -rc release.