Skip to content

Commit

Permalink
sysinfo: Remove duplicate FrequencyDetectionFailed
Browse files Browse the repository at this point in the history
  • Loading branch information
n0toose committed Jul 8, 2024
1 parent 651579d commit 9552c9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/arch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use sysinfo::System;
use thiserror::Error;

#[derive(Error, Debug)]
#[error("Frequency detection failed")]
pub struct FrequencyDetectionFailed;

#[cfg(target_arch = "x86_64")]
pub mod x86_64;

Expand All @@ -13,10 +17,6 @@ pub mod aarch64;
#[cfg(target_arch = "aarch64")]
pub use self::aarch64::*;

#[derive(Error, Debug)]
#[error("Frequency detection failed")]
pub struct FrequencyDetectionFailed;

pub fn detect_freq_from_sysinfo() -> std::result::Result<u32, FrequencyDetectionFailed> {
debug!("Trying to detect CPU frequency using sysinfo");

Expand Down
5 changes: 1 addition & 4 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::{

use log::{debug, warn};
use raw_cpuid::{CpuId, CpuIdReaderNative};
use thiserror::Error;
use uhyve_interface::{GuestPhysAddr, GuestVirtAddr};
use x86_64::{
structures::paging::{
Expand All @@ -24,9 +23,7 @@ pub const RAM_START: GuestPhysAddr = GuestPhysAddr::new(0x00);
const MHZ_TO_HZ: u64 = 1000000;
const KHZ_TO_HZ: u64 = 1000;

#[derive(Error, Debug)]
#[error("Frequency detection failed")]
pub struct FrequencyDetectionFailed;
use crate::arch::FrequencyDetectionFailed;

pub fn detect_freq_from_cpuid(
cpuid: &CpuId<CpuIdReaderNative>,
Expand Down

0 comments on commit 9552c9c

Please sign in to comment.