[PATCH] x86/ioremap: Combine prot calulation in __ioremap_caller()
From: Ted Chen
Date: Mon Nov 27 2023 - 07:49:19 EST
Combine prot calculation in __ioremap_caller() to make code more readable.
There's no need to handle pcm for UC-, WC, WT separately.
No functional change expected.
Signed-off-by: Ted Chen <znscnchen@xxxxxxxxx>
---
arch/x86/mm/ioremap.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index aa7d279321ea..6179921df3b1 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -271,16 +271,9 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
cachemode2protval(_PAGE_CACHE_MODE_UC));
break;
case _PAGE_CACHE_MODE_UC_MINUS:
- prot = __pgprot(pgprot_val(prot) |
- cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS));
- break;
case _PAGE_CACHE_MODE_WC:
- prot = __pgprot(pgprot_val(prot) |
- cachemode2protval(_PAGE_CACHE_MODE_WC));
- break;
case _PAGE_CACHE_MODE_WT:
- prot = __pgprot(pgprot_val(prot) |
- cachemode2protval(_PAGE_CACHE_MODE_WT));
+ prot = __pgprot(pgprot_val(prot) | cachemode2protval(pcm));
break;
case _PAGE_CACHE_MODE_WB:
break;
--
2.25.1