From: Greg KH <gregkh@linuxfoundation.org>
To: Nikolay Kuratov <kniv@yandex-team.ru>
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org,
Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH 6.12] tools/power turbostat: Fix compilation on older compilers
Date: Thu, 5 Feb 2026 17:25:03 +0100 [thread overview]
Message-ID: <2026020556-deprive-icky-9cd1@gregkh> (raw)
In-Reply-To: <20260205155907.1361830-1-kniv@yandex-team.ru>
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>
prev parent reply other threads:[~2026-02-05 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026020556-deprive-icky-9cd1@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=kniv@yandex-team.ru \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patryk.wlazlyn@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox