style: fix clippy warnings
This commit is contained in:
@@ -72,6 +72,7 @@ extern "C" fn __aa64_exc_sync_handler(exc: &mut ExceptionFrame) {
|
||||
|
||||
debugln!("Unhandled exception at ELR={:#018x}", exc.elr);
|
||||
|
||||
#[allow(clippy::single_match)]
|
||||
match err_code {
|
||||
EC_DATA_ABORT_ELX => {
|
||||
debugln!("Data Abort:");
|
||||
|
||||
@@ -20,7 +20,7 @@ pub const MAX_IRQ: usize = 300;
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct IrqNumber(usize);
|
||||
|
||||
/// ARM Generic Interrupt Controller
|
||||
/// ARM Generic Interrupt Controller, version 2
|
||||
pub struct Gic {
|
||||
gicc: Gicc,
|
||||
gicd: Gicd,
|
||||
@@ -34,7 +34,7 @@ impl IrqNumber {
|
||||
self.0
|
||||
}
|
||||
|
||||
///
|
||||
/// Checks and wraps an IRQ number
|
||||
#[inline(always)]
|
||||
pub const fn new(v: usize) -> Self {
|
||||
assert!(v < MAX_IRQ);
|
||||
@@ -98,7 +98,11 @@ impl IntController for Gic {
|
||||
}
|
||||
|
||||
impl Gic {
|
||||
/// Constructs an instance of GICv2.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Does not perform `gicd_base` and `gicc_base` validation.
|
||||
pub const unsafe fn new(gicd_base: usize, gicc_base: usize) -> Self {
|
||||
Self {
|
||||
gicc: Gicc::new(gicc_base),
|
||||
|
||||
@@ -86,7 +86,7 @@ impl GpioDevice for Gpio {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn get_pin_config(&self, _pin: u32) -> Result<PinConfig, Errno> {
|
||||
fn get_pin_config(&self, _pin: u32) -> Result<PinConfig, Errno> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn local_timer() -> &'static impl TimestampSource {
|
||||
&LOCAL_TIMER
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns CPU's interrupt controller device
|
||||
#[inline]
|
||||
pub fn intc() -> &'static impl IntController<IrqNumber = IrqNumber> {
|
||||
&GIC
|
||||
|
||||
@@ -41,7 +41,7 @@ pub fn local_timer() -> &'static impl TimestampSource {
|
||||
&LOCAL_TIMER
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns CPU's interrupt controller device
|
||||
#[inline]
|
||||
pub fn intc() -> &'static impl IntController<IrqNumber = IrqNumber> {
|
||||
&GIC
|
||||
|
||||
@@ -22,6 +22,10 @@ cfg_if! {
|
||||
}
|
||||
|
||||
/// Masks IRQs and returns previous IRQ mask state
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Unsafe: disables IRQ handling temporarily
|
||||
#[inline(always)]
|
||||
pub unsafe fn irq_mask_save() -> u64 {
|
||||
let state = DAIF.get();
|
||||
@@ -30,6 +34,11 @@ pub unsafe fn irq_mask_save() -> u64 {
|
||||
}
|
||||
|
||||
/// Restores IRQ mask state
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Unsafe: modifies interrupt behavior. Must only be used in
|
||||
/// conjunction with [irq_mask_save]
|
||||
#[inline(always)]
|
||||
pub unsafe fn irq_restore(state: u64) {
|
||||
DAIF.set(state);
|
||||
|
||||
@@ -41,9 +41,13 @@ pub struct PinConfig {
|
||||
/// Generic GPIO controller interface
|
||||
pub trait GpioDevice: Device {
|
||||
/// Initializes configuration for given pin
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Unsafe: changes physical pin configuration
|
||||
unsafe fn set_pin_config(&self, pin: u32, cfg: &PinConfig) -> Result<(), Errno>;
|
||||
/// Returns current configuration of given pin
|
||||
unsafe fn get_pin_config(&self, pin: u32) -> Result<PinConfig, Errno>;
|
||||
fn get_pin_config(&self, pin: u32) -> Result<PinConfig, Errno>;
|
||||
|
||||
/// Sets `pin` to HIGH state
|
||||
fn set_pin(&self, pin: u32);
|
||||
|
||||
@@ -35,7 +35,11 @@ pub trait IntSource: Device {
|
||||
}
|
||||
|
||||
impl<'q> IrqContext<'q> {
|
||||
/// Constructs an IRQ context token
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Only allowed to be constructed in top-level IRQ handlers
|
||||
#[inline(always)]
|
||||
pub unsafe fn new() -> Self {
|
||||
Self { _0: PhantomData }
|
||||
|
||||
Reference in New Issue
Block a user