mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-12 07:32:56 +00:00
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 <robert.bradford@intel.com>
This commit is contained in:
parent
827229d8e4
commit
c5d15fd938
@ -62,20 +62,20 @@ impl BusDevice for AcpiShutdownDevice {
|
||||
}
|
||||
|
||||
/// A device for handling ACPI GED event generation
|
||||
pub struct AcpiGEDDevice {
|
||||
pub struct AcpiGedDevice {
|
||||
interrupt: Arc<Box<dyn InterruptSourceGroup>>,
|
||||
notification_type: AcpiNotificationFlags,
|
||||
ged_irq: u32,
|
||||
address: GuestAddress,
|
||||
}
|
||||
|
||||
impl AcpiGEDDevice {
|
||||
impl AcpiGedDevice {
|
||||
pub fn new(
|
||||
interrupt: Arc<Box<dyn InterruptSourceGroup>>,
|
||||
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<u8> {
|
||||
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);
|
||||
|
@ -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) => {}
|
||||
|
@ -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 {
|
||||
|
@ -859,7 +859,7 @@ pub struct DeviceManager {
|
||||
|
||||
// ACPI GED notification device
|
||||
#[cfg(feature = "acpi")]
|
||||
ged_notification_device: Option<Arc<Mutex<devices::AcpiGEDDevice>>>,
|
||||
ged_notification_device: Option<Arc<Mutex<devices::AcpiGedDevice>>>,
|
||||
|
||||
// VM configuration
|
||||
config: Arc<Mutex<VmConfig>>,
|
||||
@ -1379,7 +1379,7 @@ impl DeviceManager {
|
||||
interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = LegacyIrqGroupConfig>>,
|
||||
reset_evt: EventFd,
|
||||
exit_evt: EventFd,
|
||||
) -> DeviceManagerResult<Option<Arc<Mutex<devices::AcpiGEDDevice>>>> {
|
||||
) -> DeviceManagerResult<Option<Arc<Mutex<devices::AcpiGedDevice>>>> {
|
||||
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<Mutex<dyn BusDevice>>);
|
||||
|
||||
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<Mutex<dyn BusDevice>>);
|
||||
|
Loading…
x
Reference in New Issue
Block a user