Skip to content

Commit

Permalink
staging: tidspbridge: remove gs memory allocator
Browse files Browse the repository at this point in the history
Remove unnecessary wrappers for linux kernel memory
allocation primitives.

Signed-off-by: Ionut Nicu <ionut.nicu@mindbit.ro>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
  • Loading branch information
Ionut Nicu authored and Omar Ramirez Luna committed Feb 5, 2011
1 parent 74c2d1f commit 31de278
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 183 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/tidspbridge/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o

libgen = gen/gb.o gen/gs.o gen/gh.o gen/uuidutil.o
libgen = gen/gb.o gen/gh.o gen/uuidutil.o
libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
core/tiomap3430_pwr.o core/tiomap_io.o \
core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o
Expand Down
11 changes: 5 additions & 6 deletions drivers/staging/tidspbridge/gen/gb.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/* ----------------------------------- DSP/BIOS Bridge */
#include <linux/types.h>
/* ----------------------------------- This */
#include <dspbridge/gs.h>
#include <dspbridge/gb.h>

struct gb_t_map {
Expand Down Expand Up @@ -52,17 +51,17 @@ struct gb_t_map *gb_create(u32 len)
{
struct gb_t_map *map;
u32 i;
map = (struct gb_t_map *)gs_alloc(sizeof(struct gb_t_map));
map = kzalloc(sizeof(struct gb_t_map), GFP_KERNEL);
if (map != NULL) {
map->len = len;
map->wcnt = len / BITS_PER_LONG + 1;
map->words = (u32 *) gs_alloc(map->wcnt * sizeof(u32));
map->words = kzalloc(map->wcnt * sizeof(u32), GFP_KERNEL);
if (map->words != NULL) {
for (i = 0; i < map->wcnt; i++)
map->words[i] = 0L;

} else {
gs_frees(map, sizeof(struct gb_t_map));
kfree(map);
map = NULL;
}
}
Expand All @@ -78,8 +77,8 @@ struct gb_t_map *gb_create(u32 len)

void gb_delete(struct gb_t_map *map)
{
gs_frees(map->words, map->wcnt * sizeof(u32));
gs_frees(map, sizeof(struct gb_t_map));
kfree(map->words);
kfree(map);
}

/*
Expand Down
38 changes: 9 additions & 29 deletions drivers/staging/tidspbridge/gen/gh.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#include <linux/types.h>

#include <dspbridge/host_os.h>

#include <dspbridge/gs.h>

#include <dspbridge/gh.h>

struct element {
Expand All @@ -37,8 +34,6 @@ struct gh_t_hash_tab {
};

static void noop(void *p);
static s32 cur_init;
static void myfree(void *ptr, s32 size);

/*
* ======== gh_create ========
Expand All @@ -51,8 +46,7 @@ struct gh_t_hash_tab *gh_create(u16 max_bucket, u16 val_size,
{
struct gh_t_hash_tab *hash_tab;
u16 i;
hash_tab =
(struct gh_t_hash_tab *)gs_alloc(sizeof(struct gh_t_hash_tab));
hash_tab = kzalloc(sizeof(struct gh_t_hash_tab), GFP_KERNEL);
if (hash_tab == NULL)
return NULL;
hash_tab->max_bucket = max_bucket;
Expand All @@ -62,7 +56,7 @@ struct gh_t_hash_tab *gh_create(u16 max_bucket, u16 val_size,
hash_tab->delete = delete == NULL ? noop : delete;

hash_tab->buckets = (struct element **)
gs_alloc(sizeof(struct element *) * max_bucket);
kzalloc(sizeof(struct element *) * max_bucket, GFP_KERNEL);
if (hash_tab->buckets == NULL) {
gh_delete(hash_tab);
return NULL;
Expand All @@ -89,17 +83,14 @@ void gh_delete(struct gh_t_hash_tab *hash_tab)
elem = next) {
next = elem->next;
(*hash_tab->delete) (elem->data);
myfree(elem,
sizeof(struct element) - 1 +
hash_tab->val_size);
kfree(elem);
}
}

myfree(hash_tab->buckets, sizeof(struct element *)
* hash_tab->max_bucket);
kfree(hash_tab->buckets);
}

myfree(hash_tab, sizeof(struct gh_t_hash_tab));
kfree(hash_tab);
}
}

Expand All @@ -109,9 +100,7 @@ void gh_delete(struct gh_t_hash_tab *hash_tab)

void gh_exit(void)
{
if (cur_init-- == 1)
gs_exit();

/* Do nothing */
}

/*
Expand All @@ -138,8 +127,7 @@ void *gh_find(struct gh_t_hash_tab *hash_tab, void *key)

void gh_init(void)
{
if (cur_init++ == 0)
gs_init();
/* Do nothing */
}

/*
Expand All @@ -152,8 +140,8 @@ void *gh_insert(struct gh_t_hash_tab *hash_tab, void *key, void *value)
u16 i;
char *src, *dst;

elem = (struct element *)gs_alloc(sizeof(struct element) - 1 +
hash_tab->val_size);
elem = kzalloc(sizeof(struct element) - 1 + hash_tab->val_size,
GFP_KERNEL);
if (elem != NULL) {

dst = (char *)elem->data;
Expand All @@ -180,14 +168,6 @@ static void noop(void *p)
p = p; /* stifle compiler warning */
}

/*
* ======== myfree ========
*/
static void myfree(void *ptr, s32 size)
{
gs_free(ptr);
}

#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/**
* gh_iterate() - This function goes through all the elements in the hash table
Expand Down
88 changes: 0 additions & 88 deletions drivers/staging/tidspbridge/gen/gs.c

This file was deleted.

59 changes: 0 additions & 59 deletions drivers/staging/tidspbridge/include/dspbridge/gs.h

This file was deleted.

0 comments on commit 31de278

Please sign in to comment.