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/pmc: Change LPM mode fields to u8

Change the datatypes of num_lpm_modes and lpm_en_modes[] from int
to u8. The u8 type is more appropriate and improves the readability
and maintainability of the code.

Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
Link: https://patch.msgid.link/20260108223144.504267-2-xi.pardee@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Xi Pardee and committed by
Ilpo Järvinen
65b3a922 932ca9b7

+15 -12
+13 -10
drivers/platform/x86/intel/pmc/core.c
··· 779 779 struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; 780 780 const int lpm_adj_x2 = pmc->map->lpm_res_counter_step_x2; 781 781 u32 offset = pmc->map->lpm_residency_offset; 782 - int mode; 782 + u8 mode; 783 783 784 784 seq_printf(s, "%-10s %-15s\n", "Substate", "Residency"); 785 785 ··· 838 838 enum header_type type) 839 839 { 840 840 struct pmc_dev *pmcdev = s->private; 841 - int mode; 841 + u8 mode; 842 842 843 843 seq_printf(s, "%40s |", "Element"); 844 844 pmc_for_each_mode(mode, pmcdev) ··· 880 880 const struct pmc_bit_map *map; 881 881 882 882 for (map = maps[r_idx]; map->name; map++) { 883 - int mode; 883 + u8 mode; 884 884 885 885 if (!map->blk) 886 886 continue; ··· 953 953 u32 lpm_status; 954 954 u32 lpm_status_live; 955 955 const struct pmc_bit_map *map; 956 - int mode, i, len = 32; 956 + int i, len = 32; 957 + u8 mode; 957 958 958 959 /* 959 960 * Capture the requirements and create a mask so that we only ··· 1066 1065 struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; 1067 1066 bool c10; 1068 1067 u32 reg; 1069 - int mode; 1068 + u8 mode; 1070 1069 1071 1070 reg = pmc_core_reg_read(pmc, pmc->map->lpm_sts_latch_en_offset); 1072 1071 if (reg & LPM_STS_LATCH_MODE) { ··· 1098 1097 struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; 1099 1098 bool clear = false, c10 = false; 1100 1099 unsigned char buf[8]; 1101 - int m, mode; 1100 + int mode; 1102 1101 u32 reg; 1102 + u8 m; 1103 1103 1104 1104 if (count > sizeof(buf) - 1) 1105 1105 return -EINVAL; ··· 1220 1218 u8 mode_order[LPM_MAX_NUM_MODES]; 1221 1219 u32 lpm_pri; 1222 1220 u32 lpm_en; 1221 + u8 mode; 1223 1222 unsigned int i; 1224 - int mode, p; 1223 + int p; 1225 1224 1226 1225 /* Use LPM Maps to indicate support for substates */ 1227 1226 if (!pmc->map->lpm_num_maps) ··· 1257 1254 */ 1258 1255 i = 0; 1259 1256 for (p = LPM_MAX_NUM_MODES - 1; p >= 0; p--) { 1260 - int mode = pri_order[p]; 1257 + u8 mode = pri_order[p]; 1261 1258 1262 1259 if (!(BIT(mode) & lpm_en)) 1263 1260 continue; ··· 1493 1490 { 1494 1491 const u8 *lpm_indices; 1495 1492 int num_maps, mode_offset = 0; 1496 - int ret, mode; 1497 - int lpm_size; 1493 + int ret, lpm_size; 1494 + u8 mode; 1498 1495 1499 1496 lpm_indices = pmc->map->lpm_reg_index; 1500 1497 num_maps = pmc->map->lpm_num_maps;
+2 -2
drivers/platform/x86/intel/pmc/core.h
··· 462 462 struct mutex lock; /* generic mutex lock for PMC Core */ 463 463 464 464 u64 s0ix_counter; 465 - int num_lpm_modes; 466 - int lpm_en_modes[LPM_MAX_NUM_MODES]; 465 + u8 num_lpm_modes; 466 + u8 lpm_en_modes[LPM_MAX_NUM_MODES]; 467 467 void (*suspend)(struct pmc_dev *pmcdev); 468 468 int (*resume)(struct pmc_dev *pmcdev); 469 469