[PATCH v1 02/10] port resource_overlaps() from kernel

Oleksij Rempel linux at rempel-privat.de
Wed May 16 09:42:25 PDT 2018


needed for kexec support

Signed-off-by: Oleksij Rempel <linux at rempel-privat.de>
---
 include/linux/ioport.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2a944cc73..f05937ead 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -130,6 +130,12 @@ static inline unsigned long resource_type(const struct resource *res)
 	return res->flags & IORESOURCE_TYPE_BITS;
 }
 
+/* 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);
+}
+
 struct resource *request_iomem_region(const char *name,
 		resource_size_t start, resource_size_t end);
 struct resource *request_ioport_region(const char *name,
-- 
2.14.1




More information about the barebox mailing list