From: Daniel Wagner Date: Tue, 22 Feb 2022 09:21:29 +0000 (+0100) Subject: intel: Workaround initializer element is not constant X-Git-Tag: v2.0-rc4~2^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e7309044f3ed48b0b6138dfc22a72d8fc1108580;p=users%2Fsagi%2Fnvme-cli.git intel: Workaround initializer element is not constant Older gcc do not like the constant initializer expression in the intel plugin: ../plugins/intel/intel-nvme.c: In function ‘lat_stats_log_scale’: ../plugins/intel/intel-nvme.c:662:47: error: initializer element is not constant static const int LATENCY_STATS_V4_BASE_VAL = ( Use defines as workaround. Signed-off-by: Daniel Wagner --- diff --git a/plugins/intel/intel-nvme.c b/plugins/intel/intel-nvme.c index 6afd4084..0ccff45d 100644 --- a/plugins/intel/intel-nvme.c +++ b/plugins/intel/intel-nvme.c @@ -656,12 +656,11 @@ static void show_lat_stats_linear(struct intel_lat_stats *stats, /* * For 4.0-4.5 revision. */ +#define LATENCY_STATS_V4_BASE_BITS 6 +#define LATENCY_STATS_V4_BASE_VAL (1 << LATENCY_STATS_V4_BASE_BITS) + static int lat_stats_log_scale(int i) { - static const int LATENCY_STATS_V4_BASE_BITS = 6; - static const int LATENCY_STATS_V4_BASE_VAL = ( - 1 << LATENCY_STATS_V4_BASE_BITS); - // if (i < 128) if (i < (LATENCY_STATS_V4_BASE_VAL << 1)) return i;