From: Adam Belay <ambx1@neo.rr.com>

This patch cleans up the resource conflict logic and was originally from
Matthew Wilcox <willy@debian.org>.


---

 25-akpm/drivers/pnp/resource.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff -puN drivers/pnp/resource.c~pnp-01-resource-conflict-cleanup drivers/pnp/resource.c
--- 25/drivers/pnp/resource.c~pnp-01-resource-conflict-cleanup	2004-03-14 23:58:03.082412600 -0800
+++ 25-akpm/drivers/pnp/resource.c	2004-03-14 23:58:03.083412448 -0800
@@ -231,15 +231,9 @@ void pnp_free_option(struct pnp_option *
 
 #define length(start, end) (*(end) - *(start) + 1)
 
-/* ranged_conflict - used to determine if two resource ranges conflict
- * condition 1: check if the start of a is within b
- * condition 2: check if the end of a is within b
- * condition 3: check if b is engulfed by a */
-
+/* Two ranges conflict if one doesn't end before the other starts */
 #define ranged_conflict(starta, enda, startb, endb) \
-((*(starta) >= *(startb) && *(starta) <= *(endb)) || \
- (*(enda) >= *(startb) && *(enda) <= *(endb)) || \
- (*(starta) < *(startb) && *(enda) > *(endb)))
+	!((*(enda) < *(startb)) || (*(endb) < *(starta)))
 
 #define cannot_compare(flags) \
 ((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))

_