Re: [PATCH] dspbridge: use linux memory allocator directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 02, 2009 at 07:27:10PM +0200, ext Andy Shevchenko wrote:
> From: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
> 
> 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@xxxxxxxxx>
> ---
>  arch/arm/plat-omap/include/dspbridge/list.h |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/include/dspbridge/list.h b/arch/arm/plat-omap/include/dspbridge/list.h
> index c9d9e49..cda1d21 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 = (struct LST_LIST *) kzalloc(sizeof(struct LST_LIST), flags);
>  	if (pList != NULL)
>  		INIT_LIST_HEAD(&pList->head);
>  
> @@ -116,7 +116,8 @@ static inline struct LST_LIST *LST_Create(void)
>   */
>  static inline void LST_Delete(struct LST_LIST *pList)
>  {
> -	MEM_Free(pList);
> +	if (pList != NULL)
> +		kfree(pList);

No need to check, since kfree does it for you.

--Imre

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux