[tip: x86/cache] fs/resctrl: Change pattern used to track number of entries in enum resctrl_conf_type
From: tip-bot2 for Reinette Chatre
Date: Mon Jul 27 2026 - 14:39:01 EST
The following commit has been merged into the x86/cache branch of tip:
Commit-ID: b3d683bf761d95716e60d6628eed802ad341d895
Gitweb: https://git.kernel.org/tip/b3d683bf761d95716e60d6628eed802ad341d895
Author: Reinette Chatre <reinette.chatre@xxxxxxxxx>
AuthorDate: Tue, 30 Jun 2026 21:27:03 -07:00
Committer: Borislav Petkov (AMD) <bp@xxxxxxxxx>
CommitterDate: Wed, 22 Jul 2026 14:38:18 -07:00
fs/resctrl: Change pattern used to track number of entries in enum resctrl_conf_type
CDP_NUM_TYPES tracks the number of different configuration types that can be
applied to a resource. CDP_NUM_TYPES is required to iterate over the different
configurations but is not a member of enum resctrl_conf_type to avoid the
warning generated with -Wswitch when CDP_NUM_TYPES lacks a case.
Add a new CDP_LAST enum entry used in CDP_NUM_TYPES definition to simplify
adding a new enum entry. Do this to create a cleaner pattern for tracking the
number of enum entries in resctrl in preparation for other enums needing to do
so.
Suggested-by: Ben Horgan <ben.horgan@xxxxxxx>
Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Reviewed-by: Ben Horgan <ben.horgan@xxxxxxx>
Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
Tested-by: Babu Moger <babu.moger@xxxxxxx>
Link: https://patch.msgid.link/0a7fa4675fb997b6837154dc668baa5e83dcd7d6.1782857711.git.reinette.chatre@xxxxxxxxx
---
include/linux/resctrl.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 73ff522..c3ae0e8 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -69,9 +69,10 @@ enum resctrl_conf_type {
CDP_NONE,
CDP_CODE,
CDP_DATA,
+ CDP_LAST = CDP_DATA
};
-#define CDP_NUM_TYPES (CDP_DATA + 1)
+#define CDP_NUM_TYPES (CDP_LAST + 1)
/*
* struct pseudo_lock_region - pseudo-lock region information