* [PATCH 6.12] tools/power turbostat: Fix compilation on older compilers
@ 2026-02-05 15:59 Nikolay Kuratov
2026-02-05 16:25 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Kuratov @ 2026-02-05 15:59 UTC (permalink / raw)
To: stable; +Cc: linux-kernel, linux-pm, Patryk Wlazlyn, Len Brown,
Nikolay Kuratov
Currently turbostat.c can't be built on pre-gcc-11 compilers
due to error: a label can only be part of a statement and a declaration
is not a statement.
Fix this by adding braces around case labels.
Fixes: 640540beb883 ("tools/power turbostat: Add MTL's PMT DC6 builtin counter")
Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
---
tools/power/x86/turbostat/turbostat.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index b663a76d31f1..85d40d3c6384 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2799,7 +2799,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
for (i = 0, ppmt = sys.pmt_tp; ppmt; i++, ppmt = ppmt->next) {
switch (ppmt->type) {
- case PMT_TYPE_RAW:
+ case PMT_TYPE_RAW: {
if (pmt_counter_get_width(ppmt) <= 32)
outp += sprintf(outp, "%s0x%08x", (printed++ ? delim : ""),
(unsigned int)t->pmt_counter[i]);
@@ -2807,14 +2807,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), t->pmt_counter[i]);
break;
-
- case PMT_TYPE_XTAL_TIME:
+ }
+ case PMT_TYPE_XTAL_TIME: {
const unsigned long value_raw = t->pmt_counter[i];
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
break;
- }
+ }}
}
/* C1 */
@@ -2880,7 +2880,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
for (i = 0, ppmt = sys.pmt_cp; ppmt; i++, ppmt = ppmt->next) {
switch (ppmt->type) {
- case PMT_TYPE_RAW:
+ case PMT_TYPE_RAW: {
if (pmt_counter_get_width(ppmt) <= 32)
outp += sprintf(outp, "%s0x%08x", (printed++ ? delim : ""),
(unsigned int)c->pmt_counter[i]);
@@ -2888,14 +2888,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), c->pmt_counter[i]);
break;
-
- case PMT_TYPE_XTAL_TIME:
+ }
+ case PMT_TYPE_XTAL_TIME: {
const unsigned long value_raw = c->pmt_counter[i];
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
break;
- }
+ }}
}
fmt8 = "%s%.2f";
@@ -3079,7 +3079,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
for (i = 0, ppmt = sys.pmt_pp; ppmt; i++, ppmt = ppmt->next) {
switch (ppmt->type) {
- case PMT_TYPE_RAW:
+ case PMT_TYPE_RAW: {
if (pmt_counter_get_width(ppmt) <= 32)
outp += sprintf(outp, "%s0x%08x", (printed++ ? delim : ""),
(unsigned int)p->pmt_counter[i]);
@@ -3087,14 +3087,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), p->pmt_counter[i]);
break;
-
- case PMT_TYPE_XTAL_TIME:
+ }
+ case PMT_TYPE_XTAL_TIME: {
const unsigned long value_raw = p->pmt_counter[i];
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
break;
- }
+ }}
}
done:
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 6.12] tools/power turbostat: Fix compilation on older compilers
2026-02-05 15:59 [PATCH 6.12] tools/power turbostat: Fix compilation on older compilers Nikolay Kuratov
@ 2026-02-05 16:25 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-02-05 16:25 UTC (permalink / raw)
To: Nikolay Kuratov; +Cc: stable, linux-kernel, linux-pm, Patryk Wlazlyn, Len Brown
On Thu, Feb 05, 2026 at 06:59:07PM +0300, Nikolay Kuratov wrote:
> Currently turbostat.c can't be built on pre-gcc-11 compilers
> due to error: a label can only be part of a statement and a declaration
> is not a statement.
>
> Fix this by adding braces around case labels.
>
> Fixes: 640540beb883 ("tools/power turbostat: Add MTL's PMT DC6 builtin counter")
> Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
> ---
> tools/power/x86/turbostat/turbostat.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
> index b663a76d31f1..85d40d3c6384 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -2799,7 +2799,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
>
> for (i = 0, ppmt = sys.pmt_tp; ppmt; i++, ppmt = ppmt->next) {
> switch (ppmt->type) {
> - case PMT_TYPE_RAW:
> + case PMT_TYPE_RAW: {
> if (pmt_counter_get_width(ppmt) <= 32)
> outp += sprintf(outp, "%s0x%08x", (printed++ ? delim : ""),
> (unsigned int)t->pmt_counter[i]);
> @@ -2807,14 +2807,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
> outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), t->pmt_counter[i]);
>
> break;
> -
> - case PMT_TYPE_XTAL_TIME:
> + }
> + case PMT_TYPE_XTAL_TIME: {
> const unsigned long value_raw = t->pmt_counter[i];
> const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
>
> outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
> break;
> - }
> + }}
> }
>
> /* C1 */
> @@ -2880,7 +2880,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
>
> for (i = 0, ppmt = sys.pmt_cp; ppmt; i++, ppmt = ppmt->next) {
> switch (ppmt->type) {
> - case PMT_TYPE_RAW:
> + case PMT_TYPE_RAW: {
> if (pmt_counter_get_width(ppmt) <= 32)
> outp += sprintf(outp, "%s0x%08x", (printed++ ? delim : ""),
> (unsigned int)c->pmt_counter[i]);
> @@ -2888,14 +2888,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
> outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), c->pmt_counter[i]);
>
> break;
> -
> - case PMT_TYPE_XTAL_TIME:
> + }
> + case PMT_TYPE_XTAL_TIME: {
> const unsigned long value_raw = c->pmt_counter[i];
> const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
>
> outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
> break;
> - }
> + }}
> }
>
> fmt8 = "%s%.2f";
> @@ -3079,7 +3079,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
>
> for (i = 0, ppmt = sys.pmt_pp; ppmt; i++, ppmt = ppmt->next) {
> switch (ppmt->type) {
> - case PMT_TYPE_RAW:
> + case PMT_TYPE_RAW: {
> if (pmt_counter_get_width(ppmt) <= 32)
> outp += sprintf(outp, "%s0x%08x", (printed++ ? delim : ""),
> (unsigned int)p->pmt_counter[i]);
> @@ -3087,14 +3087,14 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
> outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), p->pmt_counter[i]);
>
> break;
> -
> - case PMT_TYPE_XTAL_TIME:
> + }
> + case PMT_TYPE_XTAL_TIME: {
> const unsigned long value_raw = p->pmt_counter[i];
> const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
>
> outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
> break;
> - }
> + }}
> }
>
> done:
> --
> 2.34.1
>
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-05 16:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05 15:59 [PATCH 6.12] tools/power turbostat: Fix compilation on older compilers Nikolay Kuratov
2026-02-05 16:25 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox