summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/intel/ifs/core.c
diff options
context:
space:
mode:
authorJithu Joseph <jithu.joseph@intel.com>2023-03-21 17:33:52 -0700
committerHans de Goede <hdegoede@redhat.com>2023-03-27 16:10:20 +0200
commit54c9fcd187dd3bbc151cff9e5be01dda4f23dd0d (patch)
tree723a17185c1cd9dde3f48221364ca56154e00eda /drivers/platform/x86/intel/ifs/core.c
parent67f88ffa6d35d6b4e776f98ea64aab0bc026e2a2 (diff)
platform/x86/intel/ifs: Reorganize driver data
The struct holding device driver data contained both read only(ro) and read write(rw) fields. Separating ro fields from rw fields was recommended as a preferable design pattern during review[1]. Group ro fields into a separate const struct. Associate it to the miscdevice being registered by keeping its pointer in the same container struct as the miscdevice. Link: https://lore.kernel.org/lkml/Y+9H9otxLYPqMkUh@kroah.com/ [1] Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/r/20230322003359.213046-3-jithu.joseph@intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/intel/ifs/core.c')
-rw-r--r--drivers/platform/x86/intel/ifs/core.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c
index 3176d94b1fe5..e2bf728eefdf 100644
--- a/drivers/platform/x86/intel/ifs/core.c
+++ b/drivers/platform/x86/intel/ifs/core.c
@@ -22,11 +22,13 @@ MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids);
bool *ifs_pkg_auth;
+static const struct ifs_test_caps scan_test = {
+ .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT,
+ .test_num = 0,
+};
+
static struct ifs_device ifs_device = {
- .data = {
- .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT,
- .test_num = 0,
- },
+ .test_caps = &scan_test,
.misc = {
.name = "intel_ifs_0",
.nodename = "intel_ifs/0",
@@ -55,7 +57,7 @@ static int __init ifs_init(void)
ifs_device.misc.groups = ifs_get_groups();
- if (!(msrval & BIT(ifs_device.data.integrity_cap_bit)))
+ if (!(msrval & BIT(ifs_device.test_caps->integrity_cap_bit)))
return -ENODEV;
ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL);