From: Bhumika Goyal Date: Fri, 11 Mar 2016 14:03:04 +0000 (+0530) Subject: Staging: android: ashmem.c: Redefine macros as static inline functions X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e2a83f328f55b12b896c1467631ca414ac22980f;p=linux-beck.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 770042f6e86c..6b14efd28cd2 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -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)