diff options
author | Guillaume Tucker <guillaume.tucker@gmail.com> | 2016-12-05 18:55:38 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-12-06 10:18:07 +0100 |
commit | 8d60b476658d2df5f53301a475dc1f7edf3001af (patch) | |
tree | e36ea0f684d557e013824c284da2e7f2ba5a8f0e /drivers/staging/android | |
parent | 40270ca0de2deef44ba53c4fd88dc39fddcd006d (diff) |
staging: android: ashmem: clean up range inline functions
Clean up the code in inline functions that deal with page and
range addresses. Use bool instead of int for boolean return
types and remove superfluous brackets.
Signed-off-by: Guillaume Tucker <guillaume.tucker@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r-- | drivers/staging/android/ashmem.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index facc8a247707..7cbad0d45b9c 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -110,33 +110,33 @@ static inline bool range_on_lru(struct ashmem_range *range) return range->purged == ASHMEM_NOT_PURGED; } -static inline int page_range_subsumes_range(struct ashmem_range *range, - size_t start, size_t end) +static inline bool page_range_subsumes_range(struct ashmem_range *range, + size_t start, size_t end) { - return (((range)->pgstart >= (start)) && ((range)->pgend <= (end))); + return (range->pgstart >= start) && (range->pgend <= end); } -static inline int page_range_subsumed_by_range(struct ashmem_range *range, - size_t start, size_t end) +static inline bool page_range_subsumed_by_range(struct ashmem_range *range, + size_t start, size_t end) { - return (((range)->pgstart <= (start)) && ((range)->pgend >= (end))); + return (range->pgstart <= start) && (range->pgend >= end); } -static inline int page_in_range(struct ashmem_range *range, size_t page) +static inline bool page_in_range(struct ashmem_range *range, size_t page) { - return (((range)->pgstart <= (page)) && ((range)->pgend >= (page))); + return (range->pgstart <= page) && (range->pgend >= page); } -static inline int page_range_in_range(struct ashmem_range *range, - size_t start, size_t end) +static inline bool page_range_in_range(struct ashmem_range *range, + size_t start, size_t end) { - return (page_in_range(range, start) || page_in_range(range, end) || - page_range_subsumes_range(range, start, end)); + return page_in_range(range, start) || page_in_range(range, end) || + page_range_subsumes_range(range, start, end); } -static inline int range_before_page(struct ashmem_range *range, size_t page) +static inline bool range_before_page(struct ashmem_range *range, size_t page) { - return ((range)->pgend < (page)); + return range->pgend < page; } #define PROT_MASK (PROT_EXEC | PROT_READ | PROT_WRITE) |