From: Martin Mares Date: Sun, 15 Jun 2025 20:52:58 +0000 (+0200) Subject: Tables of strings should have both pointers and the actual strings const X-Git-Tag: v3.14.0~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2bbe1d46b628b155f691d31a8f5b5e0255f3be3f;p=thirdparty%2Fpciutils.git Tables of strings should have both pointers and the actual strings const --- diff --git a/ls-caps.c b/ls-caps.c index b4e626c..d0b0c1f 100644 --- 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]; } diff --git a/ls-ecaps.c b/ls-ecaps.c index ff8b135..63a7933 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -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",