Skip to content

Commit eb7581d

Browse files
andy-shevgregkh
authored andcommitted
resource: Constify resource crosscheck APIs
Constify APIs: _contains(), _overlaps(), _intersection(), _union(). Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 10dabdf commit eb7581d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/linux/ioport.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static inline unsigned long resource_ext_type(const struct resource *res)
229229
return res->flags & IORESOURCE_EXT_TYPE_BITS;
230230
}
231231
/* True iff r1 completely contains r2 */
232-
static inline bool resource_contains(struct resource *r1, struct resource *r2)
232+
static inline bool resource_contains(const struct resource *r1, const struct resource *r2)
233233
{
234234
if (resource_type(r1) != resource_type(r2))
235235
return false;
@@ -239,13 +239,13 @@ static inline bool resource_contains(struct resource *r1, struct resource *r2)
239239
}
240240

241241
/* True if any part of r1 overlaps r2 */
242-
static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
242+
static inline bool resource_overlaps(const struct resource *r1, const struct resource *r2)
243243
{
244244
return r1->start <= r2->end && r1->end >= r2->start;
245245
}
246246

247-
static inline bool
248-
resource_intersection(struct resource *r1, struct resource *r2, struct resource *r)
247+
static inline bool resource_intersection(const struct resource *r1, const struct resource *r2,
248+
struct resource *r)
249249
{
250250
if (!resource_overlaps(r1, r2))
251251
return false;
@@ -254,8 +254,8 @@ resource_intersection(struct resource *r1, struct resource *r2, struct resource
254254
return true;
255255
}
256256

257-
static inline bool
258-
resource_union(struct resource *r1, struct resource *r2, struct resource *r)
257+
static inline bool resource_union(const struct resource *r1, const struct resource *r2,
258+
struct resource *r)
259259
{
260260
if (!resource_overlaps(r1, r2))
261261
return false;

0 commit comments

Comments
 (0)