Message ID | 1252055941-29745-4-git-send-email-andy.shevchenko@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
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?
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 --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); } /*