Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Srinivas Pandruvada and committed by
Hans de Goede
b87434f2 7973be94

+13 -1
+13 -1
drivers/platform/x86/intel/tpmi.c
··· 598 598 struct intel_vsec_device *vsec_dev = tpmi_info->vsec_dev; 599 599 char feature_id_name[TPMI_FEATURE_NAME_LEN]; 600 600 struct intel_vsec_device *feature_vsec_dev; 601 + struct tpmi_feature_state feature_state; 601 602 struct resource *res, *tmp; 602 603 const char *name; 603 - int i; 604 + int i, ret; 605 + 606 + ret = tpmi_read_feature_status(tpmi_info, pfs->pfs_header.tpmi_id, &feature_state); 607 + if (ret) 608 + return ret; 609 + 610 + /* 611 + * If not enabled, continue to look at other features in the PFS, so return -EOPNOTSUPP. 612 + * This will not cause failure of loading of this driver. 613 + */ 614 + if (!feature_state.enabled) 615 + return -EOPNOTSUPP; 604 616 605 617 name = intel_tpmi_name(pfs->pfs_header.tpmi_id); 606 618 if (!name)