summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-09-19 08:06:22 -0600
committerTom Rini <[email protected]>2025-09-19 08:08:11 -0600
commita5de15f44d2d851a6f548fc0baa3273d350fb191 (patch)
treec15ef6e431eadb1b1bbafea98ec0a1d73d5b45aa /include
parent30fbbde2cdfaebb1db47d7c0d457a32e3c6552c3 (diff)
parentb8edd54d6022e09c5b2e9a87ede34fc0f019638d (diff)
Merge tag 'u-boot-stm32-20250919' of https://source.denx.de/u-boot/custodians/u-boot-stm into next
CI: - https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/27668 STM32MP2: - Add SPI flashes support - Add RIFSC system bus driver fixes
Diffstat (limited to 'include')
-rw-r--r--include/linux/ioport.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 85288c3729a..c12a7f70ad7 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -135,6 +135,22 @@ static inline unsigned long resource_type(const struct resource *res)
return res->flags & IORESOURCE_TYPE_BITS;
}
+/* True iff r1 completely contains r2 */
+static inline bool resource_contains(struct resource *r1, struct resource *r2)
+{
+ if (resource_type(r1) != resource_type(r2))
+ return false;
+ if (r1->flags & IORESOURCE_UNSET || r2->flags & IORESOURCE_UNSET)
+ return false;
+ return r1->start <= r2->start && r1->end >= r2->end;
+}
+
+/* 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;
+}
+
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)