[PATCH 2/4] tools/xen-cpuid: Rename decodes[] to leaf_info[]

Andrew Cooper posted 4 patches 6 months, 2 weeks ago
[PATCH 2/4] tools/xen-cpuid: Rename decodes[] to leaf_info[]
Posted by Andrew Cooper 6 months, 2 weeks ago
From: Roger Pau Monné <roger.pau@citrix.com>

Split out of subsequent patch to aid legibility.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>

v3:
 * New (split out)
---
 tools/misc/xen-cpuid.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 8893547bebce..6ee835b22949 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -268,8 +268,7 @@ static const struct {
     const char *name;
     const char *abbr;
     const char *const *strs;
-} decodes[] =
-{
+} leaf_info[] = {
     { "CPUID 0x00000001.edx",        "1d", str_1d },
     { "CPUID 0x00000001.ecx",        "1c", str_1c },
     { "CPUID 0x80000001.edx",       "e1d", str_e1d },
@@ -336,11 +335,11 @@ static void decode_featureset(const uint32_t *features,
     if ( !detail )
         return;
 
-    for ( i = 0; i < length && i < ARRAY_SIZE(decodes); ++i )
+    for ( i = 0; i < length && i < ARRAY_SIZE(leaf_info); ++i )
     {
-        printf("  [%02u] %-"COL_ALIGN"s", i, decodes[i].name ?: "<UNKNOWN>");
-        if ( decodes[i].name )
-            dump_leaf(features[i], decodes[i].strs);
+        printf("  [%02u] %-"COL_ALIGN"s", i, leaf_info[i].name ?: "<UNKNOWN>");
+        if ( leaf_info[i].name )
+            dump_leaf(features[i], leaf_info[i].strs);
         printf("\n");
     }
 }
@@ -355,8 +354,8 @@ static void dump_info(xc_interface *xch, bool detail)
     if ( !detail )
     {
         printf("       %"COL_ALIGN"s ", "KEY");
-        for ( i = 0; i < ARRAY_SIZE(decodes); ++i )
-            printf("%-8s ", decodes[i].abbr ?: "???");
+        for ( i = 0; i < ARRAY_SIZE(leaf_info); ++i )
+            printf("%-8s ", leaf_info[i].abbr ?: "???");
         printf("\n");
     }
 
-- 
2.30.2


Re: [PATCH 2/4] tools/xen-cpuid: Rename decodes[] to leaf_info[]
Posted by Roger Pau Monné 6 months, 2 weeks ago
On Fri, May 10, 2024 at 11:40:00PM +0100, Andrew Cooper wrote:
> From: Roger Pau Monné <roger.pau@citrix.com>
> 
> Split out of subsequent patch to aid legibility.

Maybe add: "No functional change intended".

> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.