Commit eb7581de authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

resource: Constify resource crosscheck APIs

Constify APIs: _contains(), _overlaps(), _intersection(), _union().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230912165312.402422-3-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 10dabdf4
...@@ -229,7 +229,7 @@ static inline unsigned long resource_ext_type(const struct resource *res) ...@@ -229,7 +229,7 @@ static inline unsigned long resource_ext_type(const struct resource *res)
return res->flags & IORESOURCE_EXT_TYPE_BITS; return res->flags & IORESOURCE_EXT_TYPE_BITS;
} }
/* True iff r1 completely contains r2 */ /* True iff r1 completely contains r2 */
static inline bool resource_contains(struct resource *r1, struct resource *r2) static inline bool resource_contains(const struct resource *r1, const struct resource *r2)
{ {
if (resource_type(r1) != resource_type(r2)) if (resource_type(r1) != resource_type(r2))
return false; return false;
...@@ -239,13 +239,13 @@ static inline bool resource_contains(struct resource *r1, struct resource *r2) ...@@ -239,13 +239,13 @@ static inline bool resource_contains(struct resource *r1, struct resource *r2)
} }
/* True if any part of r1 overlaps r2 */ /* True if any part of r1 overlaps r2 */
static inline bool resource_overlaps(struct resource *r1, struct resource *r2) static inline bool resource_overlaps(const struct resource *r1, const struct resource *r2)
{ {
return r1->start <= r2->end && r1->end >= r2->start; return r1->start <= r2->end && r1->end >= r2->start;
} }
static inline bool static inline bool resource_intersection(const struct resource *r1, const struct resource *r2,
resource_intersection(struct resource *r1, struct resource *r2, struct resource *r) struct resource *r)
{ {
if (!resource_overlaps(r1, r2)) if (!resource_overlaps(r1, r2))
return false; return false;
...@@ -254,8 +254,8 @@ resource_intersection(struct resource *r1, struct resource *r2, struct resource ...@@ -254,8 +254,8 @@ resource_intersection(struct resource *r1, struct resource *r2, struct resource
return true; return true;
} }
static inline bool static inline bool resource_union(const struct resource *r1, const struct resource *r2,
resource_union(struct resource *r1, struct resource *r2, struct resource *r) struct resource *r)
{ {
if (!resource_overlaps(r1, r2)) if (!resource_overlaps(r1, r2))
return false; return false;
......
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