Commit bba77b4a authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Adam Belay

[PNP] Resource Conflict Cleanup

This patch simplifies the ranged resource checking logic.
parent 72a3b209
...@@ -231,15 +231,9 @@ void pnp_free_option(struct pnp_option *option) ...@@ -231,15 +231,9 @@ void pnp_free_option(struct pnp_option *option)
#define length(start, end) (*(end) - *(start) + 1) #define length(start, end) (*(end) - *(start) + 1)
/* ranged_conflict - used to determine if two resource ranges conflict /* Two ranges conflict if one doesn't end before the other starts */
* 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 */
#define ranged_conflict(starta, enda, startb, endb) \ #define ranged_conflict(starta, enda, startb, endb) \
((*(starta) >= *(startb) && *(starta) <= *(endb)) || \ !((*(enda) < *(startb)) || (*(endb) < *(starta)))
(*(enda) >= *(startb) && *(enda) <= *(endb)) || \
(*(starta) < *(startb) && *(enda) > *(endb)))
#define cannot_compare(flags) \ #define cannot_compare(flags) \
((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED)) ((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment