summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rust/kernel/pci/id.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/rust/kernel/pci/id.rs b/rust/kernel/pci/id.rs
index 6e081de30faf..7f2a7f57507f 100644
--- a/rust/kernel/pci/id.rs
+++ b/rust/kernel/pci/id.rs
@@ -135,6 +135,17 @@ macro_rules! define_all_pci_vendors {
pub const $variant: Self = Self($binding as u16);
)+
}
+
+ impl fmt::Display for Vendor {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ $(
+ &Self::$variant => write!(f, stringify!($variant)),
+ )+
+ _ => <Self as fmt::Debug>::fmt(self, f),
+ }
+ }
+ }
};
}
@@ -160,13 +171,6 @@ impl fmt::Debug for Vendor {
}
}
-impl fmt::Display for Vendor {
- #[inline]
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- <Self as fmt::Debug>::fmt(self, f)
- }
-}
-
define_all_pci_classes! {
NOT_DEFINED = bindings::PCI_CLASS_NOT_DEFINED, // 0x000000
NOT_DEFINED_VGA = bindings::PCI_CLASS_NOT_DEFINED_VGA, // 0x000100