All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/7] resource: Simplify region_intersects() by reducing conditionals
@ 2020-08-13 17:57 Andy Shevchenko
  2020-08-13 17:57 ` [PATCH v1 2/7] resource: Group resource_overlaps() with other inline helpers Andy Shevchenko
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: Andy Shevchenko @ 2020-08-13 17:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, linux-acpi; +Cc: Andy Shevchenko

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>
---
 kernel/resource.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 841737bbda9e..70575a61bf20 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -554,13 +554,10 @@ 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;
-
-	return REGION_DISJOINT;
+	return (other == 0) ? REGION_INTERSECTS : REGION_MIXED;
 }
 EXPORT_SYMBOL_GPL(region_intersects);
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-08-14 17:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 17:57 [PATCH v1 1/7] resource: Simplify region_intersects() by reducing conditionals Andy Shevchenko
2020-08-13 17:57 ` [PATCH v1 2/7] resource: Group resource_overlaps() with other inline helpers Andy Shevchenko
2020-08-14 15:18   ` Rafael J. Wysocki
2020-08-14 15:37     ` Andy Shevchenko
2020-08-13 17:57 ` [PATCH v1 3/7] resource: Introduce resource_union() for overlapping resources Andy Shevchenko
2020-08-14 15:23   ` Rafael J. Wysocki
2020-08-14 15:37     ` Andy Shevchenko
2020-08-14 16:09       ` Rafael J. Wysocki
2020-08-14 16:21         ` Andy Shevchenko
2020-08-14 17:17           ` Rafael J. Wysocki
2020-08-14 17:43             ` Andy Shevchenko
2020-08-13 17:57 ` [PATCH v1 4/7] resource: Introduce resource_intersection() " Andy Shevchenko
2020-08-14 15:24   ` Rafael J. Wysocki
2020-08-14 15:38     ` Andy Shevchenko
2020-08-13 17:57 ` [PATCH v1 5/7] PCI/ACPI: Replace open coded variant of resource_union() Andy Shevchenko
2020-08-14 15:26   ` Rafael J. Wysocki
2020-08-13 17:57 ` [PATCH v1 6/7] PCI/ACPI: Fix description of @handle for acpi_is_root_bridge() Andy Shevchenko
2020-08-14 15:11   ` Rafael J. Wysocki
2020-08-14 15:18     ` Andy Shevchenko
2020-08-13 17:57 ` [PATCH v1 7/7] ACPI: watchdog: Replace open coded variant of resource_union() Andy Shevchenko
2020-08-14 15:27   ` Rafael J. Wysocki
2020-08-14 15:17 ` [PATCH v1 1/7] resource: Simplify region_intersects() by reducing conditionals Rafael J. Wysocki
2020-08-14 15:39   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.