linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/range: Const-ify range_contains parameters
@ 2024-10-10 15:24 Ira Weiny
  2024-10-10 19:55 ` Dan Williams
  2024-10-10 20:38 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Ira Weiny @ 2024-10-10 15:24 UTC (permalink / raw)
  To: David Sterba, Chris Mason, Josef Bacik
  Cc: linux-btrfs, linux-cxl, linux-kernel, David Sterba, Ira Weiny

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]
Suggested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 include/linux/range.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
 }

---
base-commit: 27cc6fdf720183dce1dbd293483ec5a9cb6b595e
change-id: 20241009-const-range-35475803a824

Best regards,
-- 
Ira Weiny <ira.weiny@intel.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-11 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 15:24 [PATCH] kernel/range: Const-ify range_contains parameters Ira Weiny
2024-10-10 19:55 ` Dan Williams
2024-10-10 20:38 ` David Sterba
2024-10-11 14:29   ` Ira Weiny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).