]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Tables of strings should have both pointers and the actual strings const
authorMartin Mares <mj@ucw.cz>
Sun, 15 Jun 2025 20:52:58 +0000 (22:52 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 15 Jun 2025 20:52:58 +0000 (22:52 +0200)
ls-caps.c
ls-ecaps.c

index b4e626c573ed97fb27a7ec7d339dd4893ffcc27f..d0b0c1fcdcdb4b74252deb7751318af3edd0a447 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -677,13 +677,13 @@ static void show_power_limit(int value, int scale)
 
 static const char *latency_l0s(int value)
 {
-  static const char *latencies[] = { "<64ns", "<128ns", "<256ns", "<512ns", "<1us", "<2us", "<4us", "unlimited" };
+  static const char * const latencies[] = { "<64ns", "<128ns", "<256ns", "<512ns", "<1us", "<2us", "<4us", "unlimited" };
   return latencies[value];
 }
 
 static const char *latency_l1(int value)
 {
-  static const char *latencies[] = { "<1us", "<2us", "<4us", "<8us", "<16us", "<32us", "<64us", "unlimited" };
+  static const char * const latencies[] = { "<1us", "<2us", "<4us", "<8us", "<16us", "<32us", "<64us", "unlimited" };
   return latencies[value];
 }
 
@@ -804,7 +804,7 @@ static char *aspm_support(int code)
 
 static const char *aspm_enabled(int code)
 {
-  static const char *desc[] = { "Disabled", "L0s Enabled", "L1 Enabled", "L0s L1 Enabled" };
+  static const char * const desc[] = { "Disabled", "L0s Enabled", "L1 Enabled", "L0s L1 Enabled" };
   return desc[code];
 }
 
@@ -872,7 +872,7 @@ static void cap_express_link(struct device *d, int where, int type)
 
 static const char *indicator(int code)
 {
-  static const char *names[] = { "Unknown", "On", "Blink", "Off" };
+  static const char * const names[] = { "Unknown", "On", "Blink", "Off" };
   return names[code];
 }
 
index ff8b135384060633b40f8e7f1523501336204ca9..63a79333850c5f4436565b340c4029ed971cc043 100644 (file)
@@ -846,8 +846,8 @@ static void
 cxl_range(u64 base, u64 size, int n)
 {
   u32 interleave[] = { 0, 256, 4096, 512, 1024, 2048, 8192, 16384 };
-  const char *type[] = { "Volatile", "Non-volatile", "CDAT" };
-  const char *class[] = { "DRAM", "Storage", "CDAT" };
+  const char * const type[] = { "Volatile", "Non-volatile", "CDAT" };
+  const char * const class[] = { "DRAM", "Storage", "CDAT" };
   u16 w;
 
   w = (u16) size;
@@ -1642,9 +1642,9 @@ static const char *ide_alg(char *buf, size_t len, u32 l)
 static void
 cap_ide(struct device *d, int where)
 {
-    const char *hdr_enc_mode[] = { "no", "17:2", "25:2", "33:2", "41:2" };
-    const char *stream_state[] = { "insecure", "reserved", "secure" };
-    const char *aggr[] = { "-", "=2", "=4", "=8" };
+    const char * const hdr_enc_mode[] = { "no", "17:2", "25:2", "33:2", "41:2" };
+    const char * const stream_state[] = { "insecure", "reserved", "secure" };
+    const char * const aggr[] = { "-", "=2", "=4", "=8" };
     u32 l, l2, linknum = 0, selnum = 0, addrnum, off, i, j;
     char buf1[16], buf2[16], offs[16];
 
@@ -1815,7 +1815,7 @@ cap_ide(struct device *d, int where)
 
 static const char *l0p_exit_latency(int value)
 {
-  static const char *latencies[] = {
+  static const char * const latencies[] = {
     "Less than 1us",
     "1us to less than 2us",
     "2us to less than 4us",