Reverse the order of operations to allow for early exits with increasing cpu offsets when reading facility bits in the extended range. This is done to ease future additions like the one in the next patch in this series. Signed-off-by: Christoph Schlameuss Reviewed-by: Nico Boehr --- lib/s390x/sclp.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index 2f902e39e785..d624872cba60 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -154,17 +154,6 @@ void sclp_facilities_setup(void) assert(read_info); cpu = sclp_get_cpu_entries(); - if (read_info->offset_cpu > 134) - sclp_facilities.has_diag318 = read_info->byte_134_diag318; - sclp_facilities.has_sop = sclp_feat_check(80, SCLP_FEAT_80_BIT_SOP); - sclp_facilities.has_gsls = sclp_feat_check(85, SCLP_FEAT_85_BIT_GSLS); - sclp_facilities.has_esop = sclp_feat_check(85, SCLP_FEAT_85_BIT_ESOP); - sclp_facilities.has_kss = sclp_feat_check(98, SCLP_FEAT_98_BIT_KSS); - sclp_facilities.has_cmma = sclp_feat_check(116, SCLP_FEAT_116_BIT_CMMA); - sclp_facilities.has_64bscao = sclp_feat_check(116, SCLP_FEAT_116_BIT_64BSCAO); - sclp_facilities.has_esca = sclp_feat_check(116, SCLP_FEAT_116_BIT_ESCA); - sclp_facilities.has_ibs = sclp_feat_check(117, SCLP_FEAT_117_BIT_IBS); - sclp_facilities.has_pfmfi = sclp_feat_check(117, SCLP_FEAT_117_BIT_PFMFI); for (i = 0; i < read_info->entries_cpu; i++, cpu++) { /* @@ -184,6 +173,20 @@ void sclp_facilities_setup(void) break; } } + + sclp_facilities.has_sop = sclp_feat_check(80, SCLP_FEAT_80_BIT_SOP); + sclp_facilities.has_gsls = sclp_feat_check(85, SCLP_FEAT_85_BIT_GSLS); + sclp_facilities.has_esop = sclp_feat_check(85, SCLP_FEAT_85_BIT_ESOP); + sclp_facilities.has_kss = sclp_feat_check(98, SCLP_FEAT_98_BIT_KSS); + sclp_facilities.has_cmma = sclp_feat_check(116, SCLP_FEAT_116_BIT_CMMA); + sclp_facilities.has_64bscao = sclp_feat_check(116, SCLP_FEAT_116_BIT_64BSCAO); + sclp_facilities.has_esca = sclp_feat_check(116, SCLP_FEAT_116_BIT_ESCA); + sclp_facilities.has_ibs = sclp_feat_check(117, SCLP_FEAT_117_BIT_IBS); + sclp_facilities.has_pfmfi = sclp_feat_check(117, SCLP_FEAT_117_BIT_PFMFI); + + if (read_info->offset_cpu <= 134) + return; + sclp_facilities.has_diag318 = read_info->byte_134_diag318; } /* Perform service call. Return 0 on success, non-zero otherwise. */ -- 2.53.0