Staging: android: ashmem.c: Redefine macros as static inline functions

Convert macros page_in_range and range_before_page into static inline
functions as static inline functions are preferred over macros. The
change can be done as the arguments at all call sites have the same type.
Also, both the macros have same type of arguments and return
values.
Done using coccinelle:

@r@
identifier f;
expression e;
@@
#define f(...) e

@r1@
identifier r.f;
identifier range,page;
expression r.e;
@@
- #define f(range,page) e
+ static inline int f(struct ashmem_range *range, size_t page)
+ {
+	return e;
+ }

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Bhumika Goyal 2016-03-11 19:33:04 +05:30 committed by Greg Kroah-Hartman
parent 0103fe20a7
commit e2a83f328f
1 changed files with 8 additions and 4 deletions

View File

@ -112,15 +112,19 @@ static struct kmem_cache *ashmem_range_cachep __read_mostly;
#define page_range_subsumed_by_range(range, start, end) \
(((range)->pgstart <= (start)) && ((range)->pgend >= (end)))
#define page_in_range(range, page) \
(((range)->pgstart <= (page)) && ((range)->pgend >= (page)))
static inline int page_in_range(struct ashmem_range *range, size_t page)
{
return (((range)->pgstart <= (page)) && ((range)->pgend >= (page)));
}
#define page_range_in_range(range, start, end) \
(page_in_range(range, start) || page_in_range(range, end) || \
page_range_subsumes_range(range, start, end))
#define range_before_page(range, page) \
((range)->pgend < (page))
static inline int range_before_page(struct ashmem_range *range, size_t page)
{
return ((range)->pgend < (page));
}
#define PROT_MASK (PROT_EXEC | PROT_READ | PROT_WRITE)