From: Ira Weiny <ira.weiny@intel.com>
To: David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, linux-cxl@vger.kernel.org,
linux-kernel@vger.kernel.org, David Sterba <dsterba@suse.cz>,
Ira Weiny <ira.weiny@intel.com>
Subject: [PATCH] kernel/range: Const-ify range_contains parameters
Date: Thu, 10 Oct 2024 10:24:42 -0500 [thread overview]
Message-ID: <20241010-const-range-v1-1-afb6e4bfd8ce@intel.com> (raw)
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>
next reply other threads:[~2024-10-10 15:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 15:24 Ira Weiny [this message]
2024-10-10 19:55 ` [PATCH] kernel/range: Const-ify range_contains parameters Dan Williams
2024-10-10 20:38 ` David Sterba
2024-10-11 14:29 ` Ira Weiny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241010-const-range-v1-1-afb6e4bfd8ce@intel.com \
--to=ira.weiny@intel.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).