1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_RANGE_H
3#define _LINUX_RANGE_H
4
5struct range {
6 u64 start;
7 u64 end;
8};
9
10int add_range(struct range *range, int az, int nr_range,
11 u64 start, u64 end);
12
13
14int add_range_with_merge(struct range *range, int az, int nr_range,
15 u64 start, u64 end);
16
17void subtract_range(struct range *range, int az, u64 start, u64 end);
18
19int clean_sort_range(struct range *range, int az);
20
21void sort_range(struct range *range, int nr_range);
22
23#define MAX_RESOURCE ((resource_size_t)~0)
24static inline resource_size_t cap_resource(u64 val)
25{
26 if (val > MAX_RESOURCE)
27 return MAX_RESOURCE;
28
29 return val;
30}
31#endif
32