Staging: android: ashmem.c: Convert macros page_range_{subsumes/subsumed_by/in}_range to static inline function

Convert macros page_range_{subsumes/subsumed_by/in}_range to static
inline function 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, all three macro have same type of arguments and return
values so they can converted using a common semantic patch.

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

@r2@
identifier r.f;
identifier range,start,end;
expression r.e;
@@
- #define f(range,start,end) e
+ static inline int f(struct ashmem_range *range, size_t start, size_t end)
+{
+	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:05 +05:30 committed by Greg Kroah-Hartman
parent e2a83f328f
commit c0ece6c383
1 changed files with 16 additions and 7 deletions

View File

@ -106,20 +106,29 @@ static struct kmem_cache *ashmem_range_cachep __read_mostly;
#define range_on_lru(range) \
((range)->purged == ASHMEM_NOT_PURGED)
#define page_range_subsumes_range(range, start, end) \
(((range)->pgstart >= (start)) && ((range)->pgend <= (end)))
static inline int page_range_subsumes_range(struct ashmem_range *range,
size_t start, size_t end)
{
return (((range)->pgstart >= (start)) && ((range)->pgend <= (end)));
}
#define page_range_subsumed_by_range(range, start, end) \
(((range)->pgstart <= (start)) && ((range)->pgend >= (end)))
static inline int page_range_subsumed_by_range(struct ashmem_range *range,
size_t start, size_t end)
{
return (((range)->pgstart <= (start)) && ((range)->pgend >= (end)));
}
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))
static inline int 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));
}
static inline int range_before_page(struct ashmem_range *range, size_t page)
{