aboutsummaryrefslogtreecommitdiff
path: root/drivers/platform/x86/intel
diff options
context:
space:
mode:
authorGravatar Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 2023-12-04 14:17:36 -0800
committerGravatar Hans de Goede <hdegoede@redhat.com> 2023-12-11 11:06:41 +0100
commitb87434f2e6fe81362d2ac57f3aba45ba89a11399 (patch)
treeb7f9f2f6803b880c3338d697010ee56746ad71f7 /drivers/platform/x86/intel
parentclk: x86: lpss-atom: Drop unneeded 'extern' in the header (diff)
downloadlinux-b87434f2e6fe81362d2ac57f3aba45ba89a11399.tar.gz
linux-b87434f2e6fe81362d2ac57f3aba45ba89a11399.tar.bz2
linux-b87434f2e6fe81362d2ac57f3aba45ba89a11399.zip
platform/x86/intel/tpmi: Don't create devices for disabled features
If some TPMI features are disabled, don't create auxiliary devices. In this way feature drivers will not load. While creating auxiliary devices, call tpmi_read_feature_status() to check feature state and return if the feature is disabled without creating a device. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20231204221740.3645130-2-srinivas.pandruvada@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/intel')
-rw-r--r--drivers/platform/x86/intel/tpmi.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/platform/x86/intel/tpmi.c b/drivers/platform/x86/intel/tpmi.c
index 311abcac894a..09972e2b8a06 100644
--- a/drivers/platform/x86/intel/tpmi.c
+++ b/drivers/platform/x86/intel/tpmi.c
@@ -598,9 +598,21 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info,
struct intel_vsec_device *vsec_dev = tpmi_info->vsec_dev;
char feature_id_name[TPMI_FEATURE_NAME_LEN];
struct intel_vsec_device *feature_vsec_dev;
+ struct tpmi_feature_state feature_state;
struct resource *res, *tmp;
const char *name;
- int i;
+ int i, ret;
+
+ ret = tpmi_read_feature_status(tpmi_info, pfs->pfs_header.tpmi_id, &feature_state);
+ if (ret)
+ return ret;
+
+ /*
+ * If not enabled, continue to look at other features in the PFS, so return -EOPNOTSUPP.
+ * This will not cause failure of loading of this driver.
+ */
+ if (!feature_state.enabled)
+ return -EOPNOTSUPP;
name = intel_tpmi_name(pfs->pfs_header.tpmi_id);
if (!name)