diff mbox

[3/4] dspbridge: use linux memory allocator directly

Message ID 1252055941-29745-4-git-send-email-andy.shevchenko@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Andy Shevchenko Sept. 4, 2009, 9:19 a.m. UTC
From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Instead of MEM_Calloc()/MEM_Free() use kzalloc()/kfree() calls. Thus we get rid
of mem.h dependency.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 arch/arm/plat-omap/include/dspbridge/list.h |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

Comments

Artem Bityutskiy Sept. 4, 2009, 11:02 a.m. UTC | #1
Nice cleanups of the cra^H^Hode now one cared about!

:-)

On 09/04/2009 12:19 PM, Andy Shevchenko wrote:
>   #define LST_ELEM            list_head
> @@ -85,9 +85,9 @@ struct LST_LIST {
>   static inline struct LST_LIST *LST_Create(void)
>   {
>   	struct LST_LIST *pList;
> +	gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
>
> -	pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
> -		MEM_NONPAGED);
> +	pList = kzalloc(sizeof(*pList), flags);
>   	if (pList != NULL)
>   		INIT_LIST_HEAD(&pList->head);

Would be nice to kill this whole function as well.
  

> @@ -116,8 +116,7 @@ static inline struct LST_LIST *LST_Create(void)
>    */
>   static inline void LST_Delete(struct LST_LIST *pList)
>   {
> -	if (pList != NULL)
> -		MEM_Free(pList);
> +	kfree(pList);
>   }

I guess whole 'LST_Delete()' could go away as well?
Andy Shevchenko Sept. 4, 2009, 11:17 a.m. UTC | #2
On Fri, Sep 4, 2009 at 2:02 PM, Artem Bityutskiy<dedekind1@gmail.com> wrote:

>>  static inline struct LST_LIST *LST_Create(void)
> Would be nice to kill this whole function as well.

> I guess whole 'LST_Delete()' could go away as well?

Good point, I thought to get rid of a bit later.
Anyway, I will look into. But probably this mean to revert back to
MEM_* calls when we would like to create or destroy list head...
diff mbox

Patch

diff --git a/arch/arm/plat-omap/include/dspbridge/list.h b/arch/arm/plat-omap/include/dspbridge/list.h
index 414579f..867f5ac 100644
--- a/arch/arm/plat-omap/include/dspbridge/list.h
+++ b/arch/arm/plat-omap/include/dspbridge/list.h
@@ -49,8 +49,8 @@ 
 #define LIST_
 
 #include <dspbridge/host_os.h>
-/* MEM_Calloc(), MEM_NONPAGED, MEM_Free() */
-#include <dspbridge/mem.h>
+#include <linux/types.h>
+#include <linux/slab.h>
 #include <linux/list.h>
 
 #define LST_ELEM            list_head
@@ -85,9 +85,9 @@  struct LST_LIST {
 static inline struct LST_LIST *LST_Create(void)
 {
 	struct LST_LIST *pList;
+	gfp_t flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
 
-	pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
-		MEM_NONPAGED);
+	pList = kzalloc(sizeof(*pList), flags);
 	if (pList != NULL)
 		INIT_LIST_HEAD(&pList->head);
 
@@ -116,8 +116,7 @@  static inline struct LST_LIST *LST_Create(void)
  */
 static inline void LST_Delete(struct LST_LIST *pList)
 {
-	if (pList != NULL)
-		MEM_Free(pList);
+	kfree(pList);
 }
 
 /*