mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
resource: Constify resource crosscheck APIs
Constify APIs: _contains(), _overlaps(), _intersection(), _union(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230912165312.402422-3-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
10dabdf45e
commit
eb7581deb4
|
|
@ -229,7 +229,7 @@ static inline unsigned long resource_ext_type(const struct resource *res)
|
|||
return res->flags & IORESOURCE_EXT_TYPE_BITS;
|
||||
}
|
||||
/* 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))
|
||||
return false;
|
||||
|
|
@ -239,13 +239,13 @@ static inline bool resource_contains(struct resource *r1, struct resource *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;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
resource_intersection(struct resource *r1, struct resource *r2, struct resource *r)
|
||||
static inline bool resource_intersection(const struct resource *r1, const struct resource *r2,
|
||||
struct resource *r)
|
||||
{
|
||||
if (!resource_overlaps(r1, r2))
|
||||
return false;
|
||||
|
|
@ -254,8 +254,8 @@ resource_intersection(struct resource *r1, struct resource *r2, struct resource
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
resource_union(struct resource *r1, struct resource *r2, struct resource *r)
|
||||
static inline bool resource_union(const struct resource *r1, const struct resource *r2,
|
||||
struct resource *r)
|
||||
{
|
||||
if (!resource_overlaps(r1, r2))
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user