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 9ec755b commit f865f47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 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
9 changes: 3 additions & 6 deletions crates/arm_gic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,9 @@ pub trait GenericArmGic: Debug + Clone + Copy + Sync + Send + Sized {
F: FnOnce(u32),
{
let intid = self.get_and_acknowledge_interrupt();
match intid {
Some(id) => {
handler(id.into());
self.end_interrupt(id);
}
None => (),
if let Some(id) = intid {
handler(id.into());
self.end_interrupt(id);
}
}
}
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

0 comments on commit f865f47

Please sign in to comment.