Skip to content

Commit 812c2d7

Browse files
jwrdegoedeKAGA-KOKO
authored andcommitted
x86/tsc_msr: Use named struct initializers
Use named struct initializers for the freq_desc struct-s initialization and change the "u8 msr_plat" to a "bool use_msr_plat" to make its meaning more clear instead of relying on a comment to explain it. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 2c523b3 commit 812c2d7

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

arch/x86/kernel/tsc_msr.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
* read in MSR_PLATFORM_ID[12:8], otherwise in MSR_PERF_STAT[44:40].
2323
* Unfortunately some Intel Atom SoCs aren't quite compliant to this,
2424
* so we need manually differentiate SoC families. This is what the
25-
* field msr_plat does.
25+
* field use_msr_plat does.
2626
*/
2727
struct freq_desc {
28-
u8 msr_plat; /* 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
28+
bool use_msr_plat;
2929
u32 freqs[MAX_NUM_FREQS];
3030
};
3131

@@ -35,31 +35,39 @@ struct freq_desc {
3535
* by MSR based on SDM.
3636
*/
3737
static const struct freq_desc freq_desc_pnw = {
38-
0, { 0, 0, 0, 0, 0, 99840, 0, 83200 }
38+
.use_msr_plat = false,
39+
.freqs = { 0, 0, 0, 0, 0, 99840, 0, 83200 },
3940
};
4041

4142
static const struct freq_desc freq_desc_clv = {
42-
0, { 0, 133200, 0, 0, 0, 99840, 0, 83200 }
43+
.use_msr_plat = false,
44+
.freqs = { 0, 133200, 0, 0, 0, 99840, 0, 83200 },
4345
};
4446

4547
static const struct freq_desc freq_desc_byt = {
46-
1, { 83300, 100000, 133300, 116700, 80000, 0, 0, 0 }
48+
.use_msr_plat = true,
49+
.freqs = { 83300, 100000, 133300, 116700, 80000, 0, 0, 0 },
4750
};
4851

4952
static const struct freq_desc freq_desc_cht = {
50-
1, { 83300, 100000, 133300, 116700, 80000, 93300, 90000, 88900, 87500 }
53+
.use_msr_plat = true,
54+
.freqs = { 83300, 100000, 133300, 116700, 80000, 93300, 90000,
55+
88900, 87500 },
5156
};
5257

5358
static const struct freq_desc freq_desc_tng = {
54-
1, { 0, 100000, 133300, 0, 0, 0, 0, 0 }
59+
.use_msr_plat = true,
60+
.freqs = { 0, 100000, 133300, 0, 0, 0, 0, 0 },
5561
};
5662

5763
static const struct freq_desc freq_desc_ann = {
58-
1, { 83300, 100000, 133300, 100000, 0, 0, 0, 0 }
64+
.use_msr_plat = true,
65+
.freqs = { 83300, 100000, 133300, 100000, 0, 0, 0, 0 },
5966
};
6067

6168
static const struct freq_desc freq_desc_lgm = {
62-
1, { 78000, 78000, 78000, 78000, 78000, 78000, 78000, 78000 }
69+
.use_msr_plat = true,
70+
.freqs = { 78000, 78000, 78000, 78000, 78000, 78000, 78000, 78000 },
6371
};
6472

6573
static const struct x86_cpu_id tsc_msr_cpu_ids[] = {
@@ -91,7 +99,7 @@ unsigned long cpu_khz_from_msr(void)
9199
return 0;
92100

93101
freq_desc = (struct freq_desc *)id->driver_data;
94-
if (freq_desc->msr_plat) {
102+
if (freq_desc->use_msr_plat) {
95103
rdmsr(MSR_PLATFORM_INFO, lo, hi);
96104
ratio = (lo >> 8) & 0xff;
97105
} else {

0 commit comments

Comments
 (0)