From 50d63aa4415b4f42a2f27d701159c1da6651f43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Mon, 27 May 2024 22:36:46 +0200 Subject: [PATCH] refactor(virtio/mmio): reuse `ComCfg::get_max_queue_size` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/drivers/virtio/transport/mmio.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/virtio/transport/mmio.rs b/src/drivers/virtio/transport/mmio.rs index 63ffe18ce4..cfabb55fe8 100644 --- a/src/drivers/virtio/transport/mmio.rs +++ b/src/drivers/virtio/transport/mmio.rs @@ -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> { - if self.com_cfg.get_max_queue_size(u32::from(index)) == 0 { + if self.get_max_queue_size(index) == 0 { None } else { Some(VqCfgHandler { @@ -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 {