From 6b8e3aeeb71aabfedc650b2a40f86a420a58912b Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 16 Dec 2021 13:09:40 -0800 Subject: [PATCH] freedreno: Rearrange dev_id_compare() logic We're going to need to add a couple more cases. Let's split up the existing two cases first, rather than piling on more logic to a single expression. Signed-off-by: Rob Clark Part-of: --- src/freedreno/common/freedreno_dev_info.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/freedreno/common/freedreno_dev_info.c b/src/freedreno/common/freedreno_dev_info.c index ca27bc433e8..725444eeb2d 100644 --- a/src/freedreno/common/freedreno_dev_info.c +++ b/src/freedreno/common/freedreno_dev_info.c @@ -47,14 +47,18 @@ dev_id_compare(const struct fd_dev_id *ref, const struct fd_dev_id *id) } else { assert(ref->chip_id && id->chip_id); /* Match on either: - * (a) exact match - * (b) device table entry has 0xff wildcard patch_id and core/ - * major/minor match + * (a) exact match: */ - return (ref->chip_id == id->chip_id) || - (((ref->chip_id & 0xff) == 0xff) && - ((ref->chip_id & UINT64_C(0xffffff00)) == - (id->chip_id & UINT64_C(0xffffff00)))); + if (ref->chip_id == id->chip_id) + return true; + /* (b) device table entry has 0xff wildcard patch_id and core/ + * major/minor match: + */ + if (((ref->chip_id & 0xff) == 0xff) && + ((ref->chip_id & UINT64_C(0xffffff00)) == + (id->chip_id & UINT64_C(0xffffff00)))) + return true; + return false; } }