# \[PATCH V2 01/68\] powerpc/cxl: Use REGION\_ID instead of opencoding

- From: Aneesh Kumar K.V \<hidden\>
- Date: 2016-04-09 06:14:25 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2016/04/9489241
- Thread: https://ratatoskr.run/linuxppc-dev/2016/04/9489240/t.md

```text
Also note that the `~` operation is wrong.

Cc: Frederic Barrat <redacted>
Cc: Andrew Donnellan <redacted>
Acked-by: Ian Munsie <redacted>
Signed-off-by: Aneesh Kumar K.V <redacted>
---
 drivers/misc/cxl/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 9a8650bcb042..9a236543da23 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -152,7 +152,7 @@ static void cxl_handle_page_fault(struct cxl_context *ctx,
 	access = _PAGE_PRESENT;
 	if (dsisr & CXL_PSL_DSISR_An_S)
 		access |= _PAGE_RW;
-	if ((!ctx->kernel) || ~(dar & (1ULL << 63)))
+	if ((!ctx->kernel) || (REGION_ID(dar) == USER_REGION_ID))
 		access |= _PAGE_USER;
 
 	if (dsisr & DSISR_NOHPTE)
-- 
2.5.0
```
