[PATCH v3 18/20] platform/x86/intel/tpmi: Use DEFINE_RES_MEM() for the feature resources
From: Kuppuswamy Sathyanarayanan
Date: Wed Sep 30 2026 - 17:13:07 EST
tpmi_create_device() fills in each feature resource field by field,
deriving the end from the start and setting IORESOURCE_MEM by hand.
That is what DEFINE_RES_MEM() exists for, so use it.
The resources come from kzalloc_flex(), so the fields the macro sets
that the open coded version left alone, name and desc, were already
zero.
No functional change intended.
Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
---
drivers/platform/x86/intel/tpmi_common.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/platform/x86/intel/tpmi_common.c b/drivers/platform/x86/intel/tpmi_common.c
index 097754365897..91d8083fecc0 100644
--- a/drivers/platform/x86/intel/tpmi_common.c
+++ b/drivers/platform/x86/intel/tpmi_common.c
@@ -583,9 +583,7 @@ static int tpmi_create_device(struct intel_tpmi_info *tpmi_info,
for (i = 0, tmp = res; i < pfs->pfs_header.num_entries; i++, tmp++) {
u64 entry_size_bytes = pfs->pfs_header.entry_size * sizeof(u32);
- tmp->start = pfs->vsec_offset + entry_size_bytes * i;
- tmp->end = tmp->start + entry_size_bytes - 1;
- tmp->flags = IORESOURCE_MEM;
+ *tmp = DEFINE_RES_MEM(pfs->vsec_offset + entry_size_bytes * i, entry_size_bytes);
}
feature_vsec_dev->dev = tpmi_info->parent;
--
2.43.0