提交 e2a83f32 编写于 作者: B Bhumika Goyal 提交者: Greg Kroah-Hartman

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: NBhumika Goyal <bhumirks@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0103fe20
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册