summaryrefslogtreecommitdiff
path: root/drivers/staging/android
diff options
context:
space:
mode:
authorBhumika Goyal <bhumirks@gmail.com>2016-03-11 19:33:05 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-11 22:09:09 -0800
commitc0ece6c383f84e0c408347cdb59456017a2f9e27 (patch)
tree65803365e102e8f2e2e2ebef09326b05d51c1ed2 /drivers/staging/android
parente2a83f328f55b12b896c1467631ca414ac22980f (diff)
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>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r--drivers/staging/android/ashmem.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 6b14efd28cd2..8a8078f954d5 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -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)
{