Skip to content

Commit

Permalink
refactor(virtio/mmio): reuse ComCfg::get_max_queue_size
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed May 27, 2024
1 parent d07e22a commit 50d63aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/drivers/virtio/transport/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl ComCfg {
///
/// INFO: The queue size is automatically bounded by constant `src::config:VIRTIO_MAX_QUEUE_SIZE`.
pub fn select_vq(&mut self, index: u16) -> Option<VqCfgHandler<'_>> {
if self.com_cfg.get_max_queue_size(u32::from(index)) == 0 {
if self.get_max_queue_size(index) == 0 {
None
} else {
Some(VqCfgHandler {
Expand All @@ -132,8 +132,8 @@ impl ComCfg {
}
}

pub fn get_max_queue_size(&mut self, sel: u32) -> u32 {
self.com_cfg.get_max_queue_size(sel)
pub fn get_max_queue_size(&mut self, sel: u16) -> u16 {
self.com_cfg.get_max_queue_size(u32::from(sel)).try_into().unwrap()
}

pub fn get_queue_ready(&mut self, sel: u32) -> bool {
Expand Down

0 comments on commit 50d63aa

Please sign in to comment.