diff options
Diffstat (limited to 'include/linux/range.h')
-rw-r--r-- | include/linux/range.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/range.h b/include/linux/range.h index 0789f1412e1f..bd184a5db791 100644 --- a/include/linux/range.h +++ b/include/linux/range.h @@ -19,4 +19,12 @@ int clean_sort_range(struct range *range, int az); void sort_range(struct range *range, int nr_range); +#define MAX_RESOURCE ((resource_size_t)~0) +static inline resource_size_t cap_resource(u64 val) +{ + if (val > MAX_RESOURCE) + return MAX_RESOURCE; + + return val; +} #endif |