diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-11-03 23:45:04 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2020-11-17 20:06:28 +0300 |
commit | 66f4fa32eb18af9a60bbda589ee239621a49bcc1 (patch) | |
tree | c4f7d8e522edd422692652fa853438ccea84744d | |
parent | 09162bc32c880a791c6c0668ce0745cf7958f576 (diff) | |
download | linux-66f4fa32eb18af9a60bbda589ee239621a49bcc1.tar.xz |
resource: Simplify region_intersects() by reducing conditionals
Now we have for 'other' and 'type' variables
other type return
0 0 REGION_DISJOINT
0 x REGION_INTERSECTS
x 0 REGION_DISJOINT
x x REGION_MIXED
Obviously it's easier to check 'type' for 0 first instead of
currently checked 'other'.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Tested-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | kernel/resource.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 3ae2f56cc79d..82df80417489 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -557,13 +557,13 @@ int region_intersects(resource_size_t start, size_t size, unsigned long flags, } read_unlock(&resource_lock); - if (other == 0) - return type ? REGION_INTERSECTS : REGION_DISJOINT; + if (type == 0) + return REGION_DISJOINT; - if (type) - return REGION_MIXED; + if (other == 0) + return REGION_INTERSECTS; - return REGION_DISJOINT; + return REGION_MIXED; } EXPORT_SYMBOL_GPL(region_intersects); |