Skip to content

Commit d29b981

Browse files
committed
Refactor and fix typos
1 parent 9b53329 commit d29b981

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/capability/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ pub enum PciCapability {
6161
}
6262

6363
impl PciCapability {
64-
fn parse(id: u8, address: PciCapabilityAddress, control: u16) -> Option<PciCapability> {
64+
fn parse(id: u8, address: PciCapabilityAddress, extension: u16) -> Option<PciCapability> {
6565
match id {
6666
0x00 => None, // null capability
6767
0x01 => Some(PciCapability::PowerManagement(address)),
6868
0x02 => Some(PciCapability::AcceleratedGraphicsPort(address)),
6969
0x03 => Some(PciCapability::VitalProductData(address)),
7070
0x04 => Some(PciCapability::SlotIdentification(address)),
71-
0x05 => Some(PciCapability::Msi(MsiCapability::new(address, control))),
71+
0x05 => Some(PciCapability::Msi(MsiCapability::new(address, extension))),
7272
0x06 => Some(PciCapability::CompactPCIHotswap(address)),
7373
0x07 => Some(PciCapability::PciX(address)),
7474
0x08 => Some(PciCapability::HyperTransport(address)),
@@ -116,14 +116,14 @@ impl<'a, T: ConfigRegionAccess> Iterator for CapabilityIterator<'a, T> {
116116
let data = unsafe { self.access.read(self.address, self.offset) };
117117
let next_ptr = data.get_bits(8..16);
118118
let id = data.get_bits(0..8);
119-
let control = data.get_bits(16..32) as u16;
119+
let extension = data.get_bits(16..32) as u16;
120120
let cap = PciCapability::parse(
121121
id as u8,
122122
PciCapabilityAddress {
123123
address: self.address,
124124
offset: self.offset,
125125
},
126-
control,
126+
extension,
127127
);
128128
self.offset = next_ptr as u16;
129129
if let Some(cap) = cap {

src/capability/msi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{capability::PciCapabilityAddress, ConfigRegionAccess};
22
use bit_field::BitField;
33
use core::convert::TryFrom;
44

5-
/// Specifies, how much MSI interrupts one device can have.
5+
/// Specifies how many MSI interrupts one device can have.
66
/// Device will modify lower bits of interrupt vector to send multiple messages, so interrupt block
77
/// must be aligned accordingly.
88
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
@@ -77,7 +77,7 @@ impl MsiCapability {
7777
self.is_64bit
7878
}
7979

80-
/// How much interrupts this device has?
80+
/// How many interrupts this device has?
8181
#[inline]
8282
pub fn get_multiple_message_capable(&self) -> MultipleMessageSupport {
8383
self.multiple_message_capable
@@ -96,7 +96,7 @@ impl MsiCapability {
9696
unsafe { access.write(self.address.address, self.address.offset, reg) };
9797
}
9898

99-
/// Set how much interrupts the device will use. If requested count is bigger than supported count,
99+
/// Set how many interrupts the device will use. If requested count is bigger than supported count,
100100
/// the second will be used.
101101
pub fn set_multiple_message_enable(
102102
&self,
@@ -108,7 +108,7 @@ impl MsiCapability {
108108
unsafe { access.write(self.address.address, self.address.offset, reg) };
109109
}
110110

111-
/// Return how much interrupts the device is using
111+
/// Return how many interrupts the device is using
112112
pub fn get_multiple_message_enable(
113113
&self,
114114
access: &impl ConfigRegionAccess,

0 commit comments

Comments
 (0)