[PATCH 6/7] x86/mm/pageattr: pass named flag instead of 0/1

Dave Hansen
2018-08-02T22:59:02Z

From: Dave Hansen <dave.hansen@linux.intel.com>

This is a cleanup. There should be functional changes in this patch.

change_page_attr_set/clear() take an 0/1 argument to indicate whether
CPA_ARRAY should be passed down to change_page_attr_set/clear().
Rather than having a 0/1 argument to turn a single flag on/off, just
pass down the flag itself.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---

b/arch/x86/mm/pageattr.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff -puN arch/x86/mm/pageattr.c~x86-pageattr-pass-flags arch/x86/mm/pageattr.c
--- a/arch/x86/mm/pageattr.c~x86-pageattr-pass-flags 2018-08-02 14:14:50.037483273 -0700
+++ b/arch/x86/mm/pageattr.c 2018-08-02 14:14:50.041483273 -0700
@@ -1525,17 +1525,17 @@ out:
}

static inline int change_page_attr_set(unsigned long *addr, int numpages,
- pgprot_t mask, int array)
+ pgprot_t mask, int flags)
{
return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0,
- (array ? CPA_ARRAY : 0), NULL);
+ flags, NULL);
}

static inline int change_page_attr_clear(unsigned long *addr, int numpages,
- pgprot_t mask, int array)
+ pgprot_t mask, int flags)
{
return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0,
- (array ? CPA_ARRAY : 0), NULL);
+ flags, NULL);
}

static inline int cpa_set_pages_array(struct page **pages, int numpages,
@@ -1609,7 +1609,8 @@ static int _set_memory_array(unsigned lo
_PAGE_CACHE_MODE_UC_MINUS : new_type;

ret = change_page_attr_set(addr, addrinarray,
- cachemode2pgprot(set_type), 1);
+ cachemode2pgprot(set_type),
+ CPA_ARRAY);

if (!ret && new_type == _PAGE_CACHE_MODE_WC)
ret = change_page_attr_set_clr(addr, addrinarray,
@@ -1732,7 +1733,8 @@ int set_memory_array_wb(unsigned long *a

/* WB cache mode is hard wired to all cache attribute bits being 0 */
ret = change_page_attr_clear(addr, addrinarray,
- __pgprot(_PAGE_CACHE_MASK), 1);
+ __pgprot(_PAGE_CACHE_MASK),
+ CPA_ARRAY);
if (ret)
return ret;

_