|
@@ -17,9 +17,6 @@
|
|
#include <linux/types.h>
|
|
#include <linux/types.h>
|
|
|
|
|
|
#include <dspbridge/host_os.h>
|
|
#include <dspbridge/host_os.h>
|
|
-
|
|
|
|
-#include <dspbridge/gs.h>
|
|
|
|
-
|
|
|
|
#include <dspbridge/gh.h>
|
|
#include <dspbridge/gh.h>
|
|
|
|
|
|
struct element {
|
|
struct element {
|
|
@@ -37,8 +34,6 @@ struct gh_t_hash_tab {
|
|
};
|
|
};
|
|
|
|
|
|
static void noop(void *p);
|
|
static void noop(void *p);
|
|
-static s32 cur_init;
|
|
|
|
-static void myfree(void *ptr, s32 size);
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
* ======== gh_create ========
|
|
* ======== gh_create ========
|
|
@@ -51,8 +46,7 @@ struct gh_t_hash_tab *gh_create(u16 max_bucket, u16 val_size,
|
|
{
|
|
{
|
|
struct gh_t_hash_tab *hash_tab;
|
|
struct gh_t_hash_tab *hash_tab;
|
|
u16 i;
|
|
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)
|
|
if (hash_tab == NULL)
|
|
return NULL;
|
|
return NULL;
|
|
hash_tab->max_bucket = max_bucket;
|
|
hash_tab->max_bucket = max_bucket;
|
|
@@ -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->delete = delete == NULL ? noop : delete;
|
|
|
|
|
|
hash_tab->buckets = (struct element **)
|
|
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) {
|
|
if (hash_tab->buckets == NULL) {
|
|
gh_delete(hash_tab);
|
|
gh_delete(hash_tab);
|
|
return NULL;
|
|
return NULL;
|
|
@@ -89,17 +83,14 @@ void gh_delete(struct gh_t_hash_tab *hash_tab)
|
|
elem = next) {
|
|
elem = next) {
|
|
next = elem->next;
|
|
next = elem->next;
|
|
(*hash_tab->delete) (elem->data);
|
|
(*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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -109,9 +100,7 @@ void gh_delete(struct gh_t_hash_tab *hash_tab)
|
|
|
|
|
|
void gh_exit(void)
|
|
void gh_exit(void)
|
|
{
|
|
{
|
|
- if (cur_init-- == 1)
|
|
|
|
- gs_exit();
|
|
|
|
-
|
|
|
|
|
|
+ /* Do nothing */
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -138,8 +127,7 @@ void *gh_find(struct gh_t_hash_tab *hash_tab, void *key)
|
|
|
|
|
|
void gh_init(void)
|
|
void gh_init(void)
|
|
{
|
|
{
|
|
- if (cur_init++ == 0)
|
|
|
|
- gs_init();
|
|
|
|
|
|
+ /* Do nothing */
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -152,8 +140,8 @@ void *gh_insert(struct gh_t_hash_tab *hash_tab, void *key, void *value)
|
|
u16 i;
|
|
u16 i;
|
|
char *src, *dst;
|
|
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) {
|
|
if (elem != NULL) {
|
|
|
|
|
|
dst = (char *)elem->data;
|
|
dst = (char *)elem->data;
|
|
@@ -180,14 +168,6 @@ static void noop(void *p)
|
|
p = p; /* stifle compiler warning */
|
|
p = p; /* stifle compiler warning */
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * ======== myfree ========
|
|
|
|
- */
|
|
|
|
-static void myfree(void *ptr, s32 size)
|
|
|
|
-{
|
|
|
|
- gs_free(ptr);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
|
|
#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
|
|
/**
|
|
/**
|
|
* gh_iterate() - This function goes through all the elements in the hash table
|
|
* gh_iterate() - This function goes through all the elements in the hash table
|