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:
parent
0103fe20a7
commit
e2a83f328f
|
@ -112,15 +112,19 @@ static struct kmem_cache *ashmem_range_cachep __read_mostly;
|
||||||
#define page_range_subsumed_by_range(range, start, end) \
|
#define page_range_subsumed_by_range(range, start, end) \
|
||||||
(((range)->pgstart <= (start)) && ((range)->pgend >= (end)))
|
(((range)->pgstart <= (start)) && ((range)->pgend >= (end)))
|
||||||
|
|
||||||
#define page_in_range(range, page) \
|
static inline int page_in_range(struct ashmem_range *range, size_t page)
|
||||||
(((range)->pgstart <= (page)) && ((range)->pgend >= (page)))
|
{
|
||||||
|
return (((range)->pgstart <= (page)) && ((range)->pgend >= (page)));
|
||||||
|
}
|
||||||
|
|
||||||
#define page_range_in_range(range, start, end) \
|
#define page_range_in_range(range, start, end) \
|
||||||
(page_in_range(range, start) || page_in_range(range, end) || \
|
(page_in_range(range, start) || page_in_range(range, end) || \
|
||||||
page_range_subsumes_range(range, start, end))
|
page_range_subsumes_range(range, start, end))
|
||||||
|
|
||||||
#define range_before_page(range, page) \
|
static inline int range_before_page(struct ashmem_range *range, size_t page)
|
||||||
((range)->pgend < (page))
|
{
|
||||||
|
return ((range)->pgend < (page));
|
||||||
|
}
|
||||||
|
|
||||||
#define PROT_MASK (PROT_EXEC | PROT_READ | PROT_WRITE)
|
#define PROT_MASK (PROT_EXEC | PROT_READ | PROT_WRITE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue