Skip to content

Commit 8ebc39a

Browse files
spandruvadajwrdegoede
authored andcommitted
tools/power/x86/intel-speed-select: Display CPU as None for -1
When there is no CPU in a power domain, display "None" instead of -1. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 1fcf670 commit 8ebc39a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tools/power/x86/intel-speed-select/isst-display.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,19 @@ static int print_package_info(struct isst_id *id, FILE *outf)
172172
int level = 1;
173173

174174
if (out_format_is_json()) {
175-
if (api_version() > 1)
176-
snprintf(header, sizeof(header), "package-%d:die-%d:powerdomain-%d:cpu-%d",
177-
id->pkg, id->die, id->punit, id->cpu);
178-
else
175+
if (api_version() > 1) {
176+
if (id->cpu < 0)
177+
snprintf(header, sizeof(header),
178+
"package-%d:die-%d:powerdomain-%d:cpu-None",
179+
id->pkg, id->die, id->punit);
180+
else
181+
snprintf(header, sizeof(header),
182+
"package-%d:die-%d:powerdomain-%d:cpu-%d",
183+
id->pkg, id->die, id->punit, id->cpu);
184+
} else {
179185
snprintf(header, sizeof(header), "package-%d:die-%d:cpu-%d",
180186
id->pkg, id->die, id->cpu);
187+
}
181188
format_and_print(outf, level, header, NULL);
182189
return 1;
183190
}
@@ -189,7 +196,12 @@ static int print_package_info(struct isst_id *id, FILE *outf)
189196
snprintf(header, sizeof(header), "powerdomain-%d", id->punit);
190197
format_and_print(outf, level++, header, NULL);
191198
}
192-
snprintf(header, sizeof(header), "cpu-%d", id->cpu);
199+
200+
if (id->cpu < 0)
201+
snprintf(header, sizeof(header), "cpu-None");
202+
else
203+
snprintf(header, sizeof(header), "cpu-%d", id->cpu);
204+
193205
format_and_print(outf, level, header, NULL);
194206

195207
return level;

0 commit comments

Comments
 (0)