diff options
author | Ira Weiny <ira.weiny@intel.com> | 2024-10-10 10:24:42 -0500 |
---|---|---|
committer | Dave Jiang <dave.jiang@intel.com> | 2024-10-28 10:06:51 -0700 |
commit | 66418687ac895717dc2f6ddffe24cf9b74cd0d3e (patch) | |
tree | 88cc6ee9ab1916f022942c501321fc05f85d5d2f /include/linux/range.h | |
parent | 81983758430957d9a5cb3333fe324fd70cf63e7e (diff) |
kernel/range: Const-ify range_contains parameters
range_contains() does not modify the range values. David suggested it
is safer to keep those parameters as const.[1]
Make range parameters const
Link: https://lore.kernel.org/all/20241008161032.GB1609@twin.jikos.cz/ [1]
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Link: https://patch.msgid.link/20241010-const-range-v1-1-afb6e4bfd8ce@intel.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Diffstat (limited to 'include/linux/range.h')
-rw-r--r-- | include/linux/range.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/range.h b/include/linux/range.h index 6ad0b73cb7ad..7dc5e835e079 100644 --- a/include/linux/range.h +++ b/include/linux/range.h @@ -13,7 +13,8 @@ static inline u64 range_len(const struct range *range) return range->end - range->start + 1; } -static inline bool range_contains(struct range *r1, struct range *r2) +static inline bool range_contains(const struct range *r1, + const struct range *r2) { return r1->start <= r2->start && r1->end >= r2->end; } |