[igt-dev] [PATCH i-g-t v9 2/4] lib/intel_mmio: fix unnecessary casting in R/W register functions

Daniel Mrzyglod daniel.t.mrzyglod at intel.com
Tue Aug 27 15:25:02 UTC 2019


This patch remove cast (volatile char *) becouse we allow arithmetic on
void pointer.

Cc: Michal Winiarski <michal.winiarski at intel.com>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Antonio Argenziano <antonio.argenziano at intel.com>
Cc: Daniele Spurio Ceraolo <daniele.ceraolospurio at intel.com>
Cc: Katarzyna Dec <katarzyna.dec at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Zbigniew KempczyƄski <zbigniew.kempczynski at intel.com>

Signed-off-by: Daniel Mrzyglod <daniel.t.mrzyglod at intel.com>
---
 lib/intel_mmio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
index a5458aeb..0d858f91 100644
--- a/lib/intel_mmio.c
+++ b/lib/intel_mmio.c
@@ -266,7 +266,7 @@ intel_register_read(uint32_t reg)
 	}
 
 read_out:
-	ret = *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg);
+	ret = *(volatile uint32_t *)(igt_global_mmio + reg);
 out:
 	return ret;
 }
@@ -303,7 +303,7 @@ intel_register_write(uint32_t reg, uint32_t val)
 		      "Register write blocked for safety ""(*0x%08x = 0x%x)\n", reg, val);
 
 write_out:
-	*(volatile uint32_t *)((volatile char *)igt_global_mmio + reg) = val;
+	*(volatile uint32_t *)(igt_global_mmio + reg) = val;
 }
 
 
@@ -321,7 +321,7 @@ write_out:
  */
 uint32_t INREG(uint32_t reg)
 {
-	return *(volatile uint32_t *)((volatile char *)igt_global_mmio + reg);
+	return *(volatile uint32_t *)(igt_global_mmio + reg);
 }
 
 /**
@@ -338,7 +338,7 @@ uint32_t INREG(uint32_t reg)
  */
 uint16_t INREG16(uint32_t reg)
 {
-	return *(volatile uint16_t *)((volatile char *)igt_global_mmio + reg);
+	return *(volatile uint16_t *)(igt_global_mmio + reg);
 }
 
 /**
@@ -371,7 +371,7 @@ uint8_t INREG8(uint32_t reg)
  */
 void OUTREG(uint32_t reg, uint32_t val)
 {
-	*(volatile uint32_t *)((volatile char *)igt_global_mmio + reg) = val;
+	*(volatile uint32_t *)(igt_global_mmio + reg) = val;
 }
 
 /**
@@ -387,7 +387,7 @@ void OUTREG(uint32_t reg, uint32_t val)
  */
 void OUTREG16(uint32_t reg, uint16_t val)
 {
-	*(volatile uint16_t *)((volatile char *)igt_global_mmio + reg) = val;
+	*(volatile uint16_t *)(igt_global_mmio + reg) = val;
 }
 
 /**
-- 
2.21.0



More information about the igt-dev mailing list