Skip to content

Commit

Permalink
clippy: fix clippy warning
Browse files Browse the repository at this point in the history
--------

Signed-off-by: guoweikang <[email protected]>
  • Loading branch information
guoweikang committed Mar 27, 2024
1 parent 5fb1dc1 commit 978035e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions crates/arm_gic/src/gic_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl GicDistributor {
fn validate_dist_version(&self) {
let pidr2 = self.regs().PIDR2.get() & Self::GIC_PIDR2_ARCH_MASK;
match pidr2 {
Self::GIC_PIDR2_ARCH_GICV3 | Self::GIC_PIDR2_ARCH_GICV4 => return,
Self::GIC_PIDR2_ARCH_GICV3 | Self::GIC_PIDR2_ARCH_GICV4 => (),
_ => panic!("unvalid gic pidr2")
}
}
Expand Down Expand Up @@ -434,7 +434,7 @@ impl GenericArmGic for GicV3 {

/// Enables the interrupt with the given ID.
fn enable_interrupt(&mut self, intid: IntId) {
let index = (intid.0 / 32) as usize;
let index = intid.0 / 32;
let bit = 1 << (intid.0 % 32);

if intid.is_private() {
Expand All @@ -445,7 +445,7 @@ impl GenericArmGic for GicV3 {
}

fn disable_interrupt(&mut self, intid: IntId) {
let index = (intid.0 / 32) as usize;
let index = intid.0 / 32;
let bit = 1 << (intid.0 % 32);

if intid.is_private() {
Expand Down
4 changes: 2 additions & 2 deletions crates/arm_gic/src/sysregs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ macro_rules! read_sysreg {
{
let mut value: u64;
::core::arch::asm!(
concat!("mrs {value:x}, ", ::core::stringify!($name)),
concat!("mrs {value}, ", ::core::stringify!($name)),
value = out(reg) value,
options(nomem, nostack),
);
Expand All @@ -19,7 +19,7 @@ macro_rules! write_sysreg {
{
let v: u64 = $value;
::core::arch::asm!(
concat!("msr ", ::core::stringify!($name), ", {value:x}"),
concat!("msr ", ::core::stringify!($name), ", {value}"),
value = in(reg) v,
options(nomem, nostack),
)
Expand Down
5 changes: 1 addition & 4 deletions modules/axhal/src/platform/aarch64_common/gic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ pub fn register_handler(irq_num: usize, handler: IrqHandler) -> bool {
pub fn dispatch_irq(_unused: usize) {
// actually no need to lock
let intid = unsafe {GIC.get_mut().get_and_acknowledge_interrupt()};
match intid {
Some(id) => {
if let Some(id) = intid {
crate::irq::dispatch_irq_common(id.into());
unsafe {GIC.get_mut().end_interrupt(id);}
}
None => (),
}
}

Expand Down

0 comments on commit 978035e

Please sign in to comment.