Skip to contentSkip to conversation

drm: Make drm_clflush_virt_range() void*

PATCH Superseded [email protected] 3 participants 6 messages Mar 31, 2014 – Apr 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Make drm_clflush_virt_range() void*

From: Ville Syrjälä <[email protected]>

Currently drm_cflush_virt_rage() takes a char* so the caller probably has to do pointless casting to avoid compiler warnings. Make the argument void* instead to avoid such issues.

---
 drivers/gpu/drm/drm_cache.c | 3 ++-
 include/drm/drmP.h          | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_cache.c +2 -1
index bb8f580..be7046e 100644
@@ -125,10 +125,11 @@ drm_clflush_sg(struct sg_table *st)
 EXPORT_SYMBOL(drm_clflush_sg);
 
 void
-drm_clflush_virt_range(char *addr, unsigned long length)
+drm_clflush_virt_range(void *virt, unsigned long length)
 {
 #if defined(CONFIG_X86)
 	if (cpu_has_clflush) {
+		char *addr = virt;
 		char *end = addr + length;
 		mb();
 		for (; addr < end; addr += boot_cpu_data.x86_clflush_size)
include/drm/drmP.h +1 -1
index 2f49510..330e868 100644
@@ -1294,7 +1294,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
 /* Cache management (drm_cache.c) */
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 void drm_clflush_sg(struct sg_table *st);
-void drm_clflush_virt_range(char *addr, unsigned long length);
+void drm_clflush_virt_range(void *virt, unsigned long length);
 
 				/* Locking IOCTL support (drm_lock.h) */
 extern int drm_lock(struct drm_device *dev, void *data,
Signature · 6 lines
1.8.3.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 7 lines · On Mon, Mar 31, 2014 at 06:08:51PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Currently drm_cflush_virt_rage() takes a char* so the caller probably has to do pointless casting to avoid compiler warnings. Make the argument void* instead to avoid such issues.

Can we not use a gcc'ism to allow pointer arithmetic on void *? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 10 lines · Chris Wilson
Quoted 7 lines · On Mon, Mar 31, 2014 at 06:08:51PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Currently drm_cflush_virt_rage() takes a char* so the caller probably has to do pointless casting to avoid compiler warnings. Make the argument void* instead to avoid such issues.

Can we not use a gcc'ism to allow pointer arithmetic on void *?

Personally I'd be fine with that. So if no one disagrees I can send a v2.

Signature · 2 lines
Ville Syrjälä
Intel OTC
#3 lore raw

PATCH v2 1/1 drm: Make drm_clflush_virt_range() void*

In reply to Chris Wilson

From: Ville Syrjälä <[email protected]>

Currently drm_cflush_virt_rage() takes a char* so the caller probably has to do pointless casting to avoid compiler warnings. Make the argument void* instead to avoid such issues.

v2: Use void* arithmetic (Chris)

---
 drivers/gpu/drm/drm_cache.c | 4 ++--
 include/drm/drmP.h          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_cache.c +2 -2
index bb8f580..4bfad5f 100644
@@ -125,11 +125,11 @@ drm_clflush_sg(struct sg_table *st)
 EXPORT_SYMBOL(drm_clflush_sg);
 
 void
-drm_clflush_virt_range(char *addr, unsigned long length)
+drm_clflush_virt_range(void *addr, unsigned long length)
 {
 #if defined(CONFIG_X86)
 	if (cpu_has_clflush) {
-		char *end = addr + length;
+		void *end = addr + length;
 		mb();
 		for (; addr < end; addr += boot_cpu_data.x86_clflush_size)
 			clflush(addr);
include/drm/drmP.h +1 -1
index 2f49510..9c10952 100644
@@ -1294,7 +1294,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
 /* Cache management (drm_cache.c) */
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 void drm_clflush_sg(struct sg_table *st);
-void drm_clflush_virt_range(char *addr, unsigned long length);
+void drm_clflush_virt_range(void *addr, unsigned long length);
 
 				/* Locking IOCTL support (drm_lock.h) */
 extern int drm_lock(struct drm_device *dev, void *data,
Signature · 6 lines
1.8.3.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 1/1
#4 lore raw
Quoted 9 lines · On Tue, Apr 01, 2014 at 12:59:08PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Currently drm_cflush_virt_rage() takes a char* so the caller probably has to do pointless casting to avoid compiler warnings. Make the argument void* instead to avoid such issues.

v2: Use void* arithmetic (Chris)

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#5 lore raw
Quoted 11 lines · Chris Wilson
Quoted 9 lines · On Tue, Apr 01, 2014 at 12:59:08PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Currently drm_cflush_virt_rage() takes a char* so the caller probably has to do pointless casting to avoid compiler warnings. Make the argument void* instead to avoid such issues.

v2: Use void* arithmetic (Chris)

Queued for -next with Dave's irc ack, thanks for the patch. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch