From 3e233af654e18acc4422e69cd375367d3b49bf38 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 26 Mar 2026 08:49:29 -0700 Subject: [PATCH] virtio-devices: vhost_user: Access acked_protocol_features directly In GenericVhostUser's read_config and write_config, access vu_common.acked_protocol_features directly instead of going through the state() method which creates a struct. This removes creating the struct just to access two fields that are already directly accessible. Signed-off-by: Rob Bradford --- virtio-devices/src/vhost_user/generic_vhost_user.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/virtio-devices/src/vhost_user/generic_vhost_user.rs b/virtio-devices/src/vhost_user/generic_vhost_user.rs index 2110e6842..368f46982 100644 --- a/virtio-devices/src/vhost_user/generic_vhost_user.rs +++ b/virtio-devices/src/vhost_user/generic_vhost_user.rs @@ -213,7 +213,8 @@ impl VirtioDevice for GenericVhostUser { } fn read_config(&self, offset: u64, data: &mut [u8]) { - if (VhostUserProtocolFeatures::CONFIG.bits() & self.state().acked_protocol_features) == 0 { + if (VhostUserProtocolFeatures::CONFIG.bits() & self.vu_common.acked_protocol_features) == 0 + { self.warn_no_config_access(); data.fill(0xFF); @@ -240,7 +241,8 @@ impl VirtioDevice for GenericVhostUser { } fn write_config(&mut self, offset: u64, data: &[u8]) { - if (VhostUserProtocolFeatures::CONFIG.bits() & self.state().acked_protocol_features) == 0 { + if (VhostUserProtocolFeatures::CONFIG.bits() & self.vu_common.acked_protocol_features) == 0 + { self.warn_no_config_access(); return; }