* [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* Re: [PATCH] kernel/range: Const-ify range_contains parameters
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
1 sibling, 0 replies; 4+ messages in thread
From: Dan Williams @ 2024-10-10 19:55 UTC (permalink / raw)
To: Ira Weiny, David Sterba, Chris Mason, Josef Bacik
Cc: linux-btrfs, linux-cxl, linux-kernel, David Sterba, Ira Weiny
Ira Weiny wrote:
> 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>
LGTM
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/range: Const-ify range_contains parameters
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
1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2024-10-10 20:38 UTC (permalink / raw)
To: Ira Weiny
Cc: David Sterba, Chris Mason, Josef Bacik, linux-btrfs, linux-cxl,
linux-kernel, David Sterba
On Thu, Oct 10, 2024 at 10:24:42AM -0500, Ira Weiny wrote:
> 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>
You can drop the above line.
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/range: Const-ify range_contains parameters
2024-10-10 20:38 ` David Sterba
@ 2024-10-11 14:29 ` Ira Weiny
0 siblings, 0 replies; 4+ messages in thread
From: Ira Weiny @ 2024-10-11 14:29 UTC (permalink / raw)
To: David Sterba, Ira Weiny
Cc: David Sterba, Chris Mason, Josef Bacik, linux-btrfs, linux-cxl,
linux-kernel, David Sterba
David Sterba wrote:
> On Thu, Oct 10, 2024 at 10:24:42AM -0500, Ira Weiny wrote:
> > 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>
>
> You can drop the above line.
Done.
>
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
>
> Reviewed-by: David Sterba <dsterba@suse.com>
Queued in the cxl-next tree.
Thanks!
Ira
^ permalink raw reply [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).