Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / range.h
blobd1fbeb66401241f3f0a0dfdbc6deebef8eb63428
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_RANGE_H
3 #define _LINUX_RANGE_H
5 struct range {
6 u64 start;
7 u64 end;
8 };
10 int add_range(struct range *range, int az, int nr_range,
11 u64 start, u64 end);
14 int add_range_with_merge(struct range *range, int az, int nr_range,
15 u64 start, u64 end);
17 void subtract_range(struct range *range, int az, u64 start, u64 end);
19 int clean_sort_range(struct range *range, int az);
21 void sort_range(struct range *range, int nr_range);
23 #define MAX_RESOURCE ((resource_size_t)~0)
24 static inline resource_size_t cap_resource(u64 val)
26 if (val > MAX_RESOURCE)
27 return MAX_RESOURCE;
29 return val;
31 #endif