From 74d24b219bc4ebb20b75d63af2bb577bc1b10b5e Mon Sep 17 00:00:00 2001 From: Wei Yang Date: Thu, 26 Apr 2012 15:32:55 +0800 Subject: resources: add resource_overlaps() Add resource_overlaps(), which returns true if two resources overlap at all. Use this to replace the complicated check in coalesce_windows(). Signed-Off-By: Wei Yang Signed-off-by: Bjorn Helgaas --- include/linux/ioport.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux/ioport.h') diff --git a/include/linux/ioport.h b/include/linux/ioport.h index e885ba23de70..589e0e75efae 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -223,5 +223,12 @@ extern int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, void *arg, int (*func)(unsigned long, unsigned long, void *)); +/* True if any part of r1 overlaps r2 */ +static inline bool resource_overlaps(struct resource *r1, struct resource *r2) +{ + return (r1->start <= r2->end && r1->end >= r2->start); +} + + #endif /* __ASSEMBLY__ */ #endif /* _LINUX_IOPORT_H */ -- cgit v1.2.1