Skip to content

Commit 71ae94a

Browse files
Remove convenience methods priority() and interrupt_id() from mtopi
These methods were simple aliases for ipid() and iid() respectively, which doesn't follow the crate's pattern of only adding convenience methods that provide semantic value or logical operations.
1 parent 3a5c598 commit 71ae94a

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

riscv/src/register/mtopi.rs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
//! let mtopi_val = mtopi::read();
1414
//!
1515
//! if mtopi_val.has_interrupt() {
16-
//! let interrupt_id = mtopi_val.interrupt_id();
17-
//! let priority = mtopi_val.priority();
16+
//! let interrupt_id = mtopi_val.iid();
17+
//! let priority = mtopi_val.ipid();
1818
//! println!("Highest priority interrupt: ID={}, Priority={}", interrupt_id, priority);
1919
//! } else {
2020
//! println!("No interrupts pending");
@@ -53,23 +53,6 @@ impl Mtopi {
5353
pub fn has_interrupt(&self) -> bool {
5454
self.iid() != 0
5555
}
56-
57-
/// Returns the interrupt priority, with higher values indicating higher priority
58-
///
59-
/// This value is only meaningful when `has_interrupt()` returns true.
60-
#[inline]
61-
pub fn priority(&self) -> usize {
62-
self.ipid()
63-
}
64-
65-
/// Returns the interrupt identifier
66-
///
67-
/// A value of 0 indicates no interrupt is pending. Non-zero values identify
68-
/// specific interrupt sources as defined by the interrupt controller configuration.
69-
#[inline]
70-
pub fn interrupt_id(&self) -> usize {
71-
self.iid()
72-
}
7356
}
7457

7558
#[cfg(test)]
@@ -88,16 +71,12 @@ mod tests {
8871

8972
// Test helper methods
9073
assert!(!mtopi.has_interrupt());
91-
assert_eq!(mtopi.priority(), 0);
92-
assert_eq!(mtopi.interrupt_id(), 0);
9374

9475
// Test with some interrupt pending (IID = 11, IPID = 5)
9576
mtopi = Mtopi::from_bits((11 << 16) | 5);
9677
test_csr_field!(mtopi, iid: [16, 27]);
9778
test_csr_field!(mtopi, ipid: [0, 7]);
9879
assert!(mtopi.has_interrupt());
99-
assert_eq!(mtopi.priority(), 5);
100-
assert_eq!(mtopi.interrupt_id(), 11);
10180

10281
// Test maximum values for each field
10382
mtopi = Mtopi::from_bits((0xFFF << 16) | 0xFF);

0 commit comments

Comments
 (0)