From e14e56349f436d5f4e18f614f7629c2afb21ada2 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 9 Jun 2024 21:40:43 +0200 Subject: [PATCH] pcid: Remove method to get the current feature status Devices should never change the feature status behind the back of the driver, so storing the current status after setting it is fine. Drivers should reset all state when they start to recover from a crashed driver, so they shouldn't need to get the current feature status at startup either. --- pcid/src/driver_handler.rs | 27 --------------------------- pcid/src/driver_interface/mod.rs | 8 -------- 2 files changed, 35 deletions(-) diff --git a/pcid/src/driver_handler.rs b/pcid/src/driver_handler.rs index 4ecb55a4c7..741e374fe4 100644 --- a/pcid/src/driver_handler.rs +++ b/pcid/src/driver_handler.rs @@ -169,33 +169,6 @@ impl DriverHandler { PcidClientResponse::FeatureEnabled(feature) } }, - PcidClientRequest::FeatureStatus(feature) => PcidClientResponse::FeatureStatus( - feature, - match feature { - PciFeature::Msi => self - .capabilities - .iter() - .find_map(|capability| { - if let PciCapability::Msi(msi) = capability { - Some(FeatureStatus::enabled(msi.enabled())) - } else { - None - } - }) - .unwrap_or(FeatureStatus::Disabled), - PciFeature::MsiX => self - .capabilities - .iter() - .find_map(|capability| { - if let PciCapability::MsiX(msix) = capability { - Some(FeatureStatus::enabled(msix.msix_enabled())) - } else { - None - } - }) - .unwrap_or(FeatureStatus::Disabled), - }, - ), PcidClientRequest::FeatureInfo(feature) => PcidClientResponse::FeatureInfo( feature, match feature { diff --git a/pcid/src/driver_interface/mod.rs b/pcid/src/driver_interface/mod.rs index aa03a9d587..32e324ec4e 100644 --- a/pcid/src/driver_interface/mod.rs +++ b/pcid/src/driver_interface/mod.rs @@ -194,7 +194,6 @@ pub enum PcidClientRequest { RequestFeatures, RequestCapabilities, EnableFeature(PciFeature), - FeatureStatus(PciFeature), FeatureInfo(PciFeature), SetFeatureInfo(SetFeatureInfo), ReadConfig(u16), @@ -295,13 +294,6 @@ impl PcidServerHandle { other => Err(PcidClientHandleError::InvalidResponse(other)), } } - pub fn feature_status(&mut self, feature: PciFeature) -> Result { - self.send(&PcidClientRequest::FeatureStatus(feature))?; - match self.recv()? { - PcidClientResponse::FeatureStatus(feat, status) if feat == feature => Ok(status), - other => Err(PcidClientHandleError::InvalidResponse(other)), - } - } pub fn enable_feature(&mut self, feature: PciFeature) -> Result<()> { self.send(&PcidClientRequest::EnableFeature(feature))?; match self.recv()? {