Skip to content

Commit 6b32a8c

Browse files
jiangliuandreeaflorescu
authored andcommitted
virtio: improve code readability of MmioDevice::read()
The MMIO based VirtIO devices support the VirtIO 1.0 capability, but the code is a little hard to be understood. Improve code readability by adding a comment. Signed-off-by: Liu Jiang <[email protected]>
1 parent 475e13a commit 6b32a8c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

devices/src/virtio/mmio.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,11 @@ impl BusDevice for MmioDevice {
183183
0x08 => self.device.device_type(),
184184
0x0c => VENDOR_ID, // vendor id
185185
0x10 => {
186-
self.device.features(self.features_select)
187-
| if self.features_select == 1 { 0x1 } else { 0x0 }
186+
let mut features = self.device.features(self.features_select);
187+
if self.features_select == 1 {
188+
features |= 0x1; // enable support of VirtIO Version 1
189+
}
190+
features
188191
}
189192
0x34 => self.with_queue(0, |q| q.get_max_size() as u32),
190193
0x44 => self.with_queue(0, |q| q.ready as u32),

0 commit comments

Comments
 (0)