From c5d15fd938139d8c223c1e474818df3d94329da5 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 25 Mar 2021 17:01:21 +0000 Subject: [PATCH] devices: Address Rust 1.51.0 clippy issue (upper_case_acroynms) warning: name `AcpiPMTimerDevice` contains a capitalized acronym --> devices/src/acpi.rs:175:12 | 175 | pub struct AcpiPMTimerDevice { | ^^^^^^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `AcpiPmTimerDevice` | = note: `#[warn(clippy::upper_case_acronyms)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms Signed-off-by: Rob Bradford --- devices/src/acpi.rs | 20 ++++++++++---------- devices/src/ioapic.rs | 8 ++++---- devices/src/lib.rs | 2 +- vmm/src/device_manager.rs | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/devices/src/acpi.rs b/devices/src/acpi.rs index 395e9b25b..6cb2f4a16 100644 --- a/devices/src/acpi.rs +++ b/devices/src/acpi.rs @@ -62,20 +62,20 @@ impl BusDevice for AcpiShutdownDevice { } /// A device for handling ACPI GED event generation -pub struct AcpiGEDDevice { +pub struct AcpiGedDevice { interrupt: Arc>, notification_type: AcpiNotificationFlags, ged_irq: u32, address: GuestAddress, } -impl AcpiGEDDevice { +impl AcpiGedDevice { pub fn new( interrupt: Arc>, ged_irq: u32, address: GuestAddress, - ) -> AcpiGEDDevice { - AcpiGEDDevice { + ) -> AcpiGedDevice { + AcpiGedDevice { interrupt, notification_type: AcpiNotificationFlags::NO_DEVICES_CHANGED, ged_irq, @@ -97,7 +97,7 @@ impl AcpiGEDDevice { } // I/O port reports what type of notification was made -impl BusDevice for AcpiGEDDevice { +impl BusDevice for AcpiGedDevice { // Spec has all fields as zero fn read(&mut self, _base: u64, _offset: u64, data: &mut [u8]) { data[0] = self.notification_type.bits(); @@ -106,7 +106,7 @@ impl BusDevice for AcpiGEDDevice { } #[cfg(feature = "acpi")] -impl Aml for AcpiGEDDevice { +impl Aml for AcpiGedDevice { fn to_aml_bytes(&self) -> Vec { aml::Device::new( "_SB_.GED_".into(), @@ -172,11 +172,11 @@ impl Aml for AcpiGEDDevice { } } -pub struct AcpiPMTimerDevice { +pub struct AcpiPmTimerDevice { start: Instant, } -impl AcpiPMTimerDevice { +impl AcpiPmTimerDevice { pub fn new() -> Self { Self { start: Instant::now(), @@ -184,13 +184,13 @@ impl AcpiPMTimerDevice { } } -impl Default for AcpiPMTimerDevice { +impl Default for AcpiPmTimerDevice { fn default() -> Self { Self::new() } } -impl BusDevice for AcpiPMTimerDevice { +impl BusDevice for AcpiPmTimerDevice { fn read(&mut self, _base: u64, _offset: u64, data: &mut [u8]) { let now = Instant::now(); let since = now.duration_since(self.start); diff --git a/devices/src/ioapic.rs b/devices/src/ioapic.rs index 89afeeb36..2ecbb01d1 100644 --- a/devices/src/ioapic.rs +++ b/devices/src/ioapic.rs @@ -113,9 +113,9 @@ enum TriggerMode { enum DeliveryMode { Fixed = 0b000, Lowest = 0b001, - SMI = 0b010, // System management interrupt + Smi = 0b010, // System management interrupt RemoteRead = 0b011, // This is no longer supported by intel. - NMI = 0b100, // Non maskable interrupt + Nmi = 0b100, // Non maskable interrupt Init = 0b101, Startup = 0b110, External = 0b111, @@ -333,9 +333,9 @@ impl Ioapic { match delivery_mode { x if (x == DeliveryMode::Fixed as u8) || (x == DeliveryMode::Lowest as u8) - || (x == DeliveryMode::SMI as u8) + || (x == DeliveryMode::Smi as u8) || (x == DeliveryMode::RemoteRead as u8) - || (x == DeliveryMode::NMI as u8) + || (x == DeliveryMode::Nmi as u8) || (x == DeliveryMode::Init as u8) || (x == DeliveryMode::Startup as u8) || (x == DeliveryMode::External as u8) => {} diff --git a/devices/src/lib.rs b/devices/src/lib.rs index c890e6424..0c26397a7 100644 --- a/devices/src/lib.rs +++ b/devices/src/lib.rs @@ -35,7 +35,7 @@ pub mod ioapic; pub mod legacy; #[cfg(feature = "acpi")] -pub use self::acpi::{AcpiGEDDevice, AcpiPMTimerDevice, AcpiShutdownDevice}; +pub use self::acpi::{AcpiGedDevice, AcpiPmTimerDevice, AcpiShutdownDevice}; bitflags! { pub struct AcpiNotificationFlags: u8 { diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 1b2ff3a76..6f1975825 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -859,7 +859,7 @@ pub struct DeviceManager { // ACPI GED notification device #[cfg(feature = "acpi")] - ged_notification_device: Option>>, + ged_notification_device: Option>>, // VM configuration config: Arc>, @@ -1379,7 +1379,7 @@ impl DeviceManager { interrupt_manager: &Arc>, reset_evt: EventFd, exit_evt: EventFd, - ) -> DeviceManagerResult>>> { + ) -> DeviceManagerResult>>> { let shutdown_device = Arc::new(Mutex::new(devices::AcpiShutdownDevice::new( exit_evt, reset_evt, ))); @@ -1421,7 +1421,7 @@ impl DeviceManager { .unwrap() .allocate_mmio_addresses(None, devices::acpi::GED_DEVICE_ACPI_SIZE as u64, None) .ok_or(DeviceManagerError::AllocateMmioAddress)?; - let ged_device = Arc::new(Mutex::new(devices::AcpiGEDDevice::new( + let ged_device = Arc::new(Mutex::new(devices::AcpiGedDevice::new( interrupt_group, ged_irq, ged_address, @@ -1437,7 +1437,7 @@ impl DeviceManager { self.bus_devices .push(Arc::clone(&ged_device) as Arc>); - let pm_timer_device = Arc::new(Mutex::new(devices::AcpiPMTimerDevice::new())); + let pm_timer_device = Arc::new(Mutex::new(devices::AcpiPmTimerDevice::new())); self.bus_devices .push(Arc::clone(&pm_timer_device) as Arc>);