diff options
author | Sagar Ghuge <[email protected]> | 2018-09-05 21:14:23 -0700 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2018-10-04 10:01:56 +0100 |
commit | 29a2eaf3db1520a5bc7b80d39c0feac1d2165388 (patch) | |
tree | 0775d85a1157338f86be88137681824e1fe22ce6 /src | |
parent | f9c8468c824dd9ceb804b6c9e177b738f8340a26 (diff) |
intel/decoder: construct correct xml filename
construct correct gen xml filename when we try to load hardware xml
description from a given path
v2: remove temporary variable (Francesco Ansanelli)
Signed-off-by: Sagar Ghuge <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/common/gen_decoder.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 38a5fccb2ab..5f6e7a0b808 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -463,14 +463,13 @@ character_data(void *data, const XML_Char *s, int len) } static int -devinfo_to_gen(const struct gen_device_info *devinfo) +devinfo_to_gen(const struct gen_device_info *devinfo, bool x10) { - int value = 10 * devinfo->gen; - - if (devinfo->is_baytrail || devinfo->is_haswell) - value += 5; + if (devinfo->is_baytrail || devinfo->is_haswell) { + return devinfo->gen * 10 + 5; + } - return value; + return x10 ? devinfo->gen * 10 : devinfo->gen; } static uint32_t zlib_inflate(const void *compressed_data, @@ -558,7 +557,7 @@ gen_spec_load(const struct gen_device_info *devinfo) uint8_t *text_data = NULL; uint32_t text_offset = 0, text_length = 0; MAYBE_UNUSED uint32_t total_length; - uint32_t gen_10 = devinfo_to_gen(devinfo); + uint32_t gen_10 = devinfo_to_gen(devinfo, true); for (int i = 0; i < ARRAY_SIZE(genxml_files_table); i++) { if (genxml_files_table[i].gen_10 == gen_10) { @@ -627,7 +626,7 @@ gen_spec_load_from_path(const struct gen_device_info *devinfo, FILE *input; len = snprintf(filename, filename_len, "%s/gen%i.xml", - path, devinfo_to_gen(devinfo)); + path, devinfo_to_gen(devinfo, false)); assert(len < filename_len); input = fopen(filename, "r"); |