Skip to contentSkip to conversation

drm: use kvfree instead of opencoding

PATCH In review Dave Airlie 2 participants 2 messages Jan 29, 2015

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm: use kvfree instead of opencoding

From: Dave Airlie <[email protected]>

Al Viro added this to the mm finally, so instead
of opencoding it use kvfree instead.

---
 drivers/gpu/drm/nouveau/nouveau_gem.c | 5 +----
 include/drm/drm_mem_util.h            | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -4
index 7c077fc..7270649 100644
@@ -552,10 +552,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 static inline void
 u_free(void *addr)
 {
-	if (!is_vmalloc_addr(addr))
-		kfree(addr);
-	else
-		vfree(addr);
+	kvfree(addr);
 }
 
 static inline void *
include/drm/drm_mem_util.h +1 -4
index 19a2404..e42495a 100644
@@ -56,10 +56,7 @@ static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
 
 static __inline void drm_free_large(void *ptr)
 {
-	if (!is_vmalloc_addr(ptr))
-		return kfree(ptr);
-
-	vfree(ptr);
+	kvfree(ptr);
 }
 
 #endif
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 34 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Al Viro added this to the mm finally, so instead
of opencoding it use kvfree instead.

---
 drivers/gpu/drm/nouveau/nouveau_gem.c | 5 +----
 include/drm/drm_mem_util.h            | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -4
index 7c077fc..7270649 100644
@@ -552,10 +552,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 static inline void
 u_free(void *addr)
 {
-	if (!is_vmalloc_addr(addr))
-		kfree(addr);
-	else
-		vfree(addr);
+	kvfree(addr);
 }
 
 static inline void *
include/drm/drm_mem_util.h +0 -0
index 19a2404..e42495a 100644
@@ -56,10 +56,7 @@ static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
 

include/drm/drm_mem_util.h static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) · line 62

Quoted 10 lines
include/drm/drm_mem_util.h +1 -4
 static __inline void drm_free_large(void *ptr)
 {
-	if (!is_vmalloc_addr(ptr))
-		return kfree(ptr);
-
-	vfree(ptr);
+	kvfree(ptr);
 }
 
 #endif

Any reason for keeping the u_free and drm_free_large wrappers?

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel