[PATCH 3/5] scripts: restore host hash table macro names

From: Julian Braha

Date: Thu Nov 26 2026 - 19:00:48 EST


This partially reverts commit 0a3128e75108 ("kconfig: add macros useful
for hashtable").

Rename HASHTABLE_DECLARE() to DECLARE_HASHTABLE() and HASHTABLE_DEFINE()
to DEFINE_HASHTABLE() in the host scripts/include/hashtable.h, bringing
the signatures closer to the original in-kernel implementation, and update
the callers, accordingly.

Signed-off-by: Julian Braha <julianbraha@xxxxxxxxx>
---
This patch isn't really necessary to fix the issue, but it does make
maintenance a tad easier when you're looking at the two implementations
side-by-side.
---
scripts/gendwarfksyms/die.c | 2 +-
scripts/gendwarfksyms/gendwarfksyms.h | 2 +-
scripts/gendwarfksyms/kabi.c | 2 +-
scripts/gendwarfksyms/symbols.c | 4 ++--
scripts/gendwarfksyms/types.c | 2 +-
scripts/genksyms/genksyms.c | 2 +-
scripts/include/hashtable.h | 6 +++---
scripts/kconfig/expr.c | 2 +-
scripts/kconfig/internal.h | 4 ++--
scripts/kconfig/symbol.c | 2 +-
scripts/kconfig/util.c | 2 +-
scripts/mod/modpost.c | 2 +-
12 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/scripts/gendwarfksyms/die.c b/scripts/gendwarfksyms/die.c
index 4e390a6295a3..79d738e69ce5 100644
--- a/scripts/gendwarfksyms/die.c
+++ b/scripts/gendwarfksyms/die.c
@@ -9,7 +9,7 @@
#define DIE_HASH_BITS 16

/* {die->addr, state} -> struct die * */
-static HASHTABLE_DEFINE(die_map, 1 << DIE_HASH_BITS);
+static DEFINE_HASHTABLE(die_map, 1 << DIE_HASH_BITS);

static unsigned int map_hits;
static unsigned int map_misses;
diff --git a/scripts/gendwarfksyms/gendwarfksyms.h b/scripts/gendwarfksyms/gendwarfksyms.h
index f4f21d6090e7..c987acbbf1ef 100644
--- a/scripts/gendwarfksyms/gendwarfksyms.h
+++ b/scripts/gendwarfksyms/gendwarfksyms.h
@@ -208,7 +208,7 @@ void die_map_free(void);

/* A cache for addresses we've already seen. */
struct cache {
- HASHTABLE_DECLARE(cache, 1 << CACHE_HASH_BITS);
+ DECLARE_HASHTABLE(cache, 1 << CACHE_HASH_BITS);
};

void cache_set(struct cache *cache, unsigned long key, int value);
diff --git a/scripts/gendwarfksyms/kabi.c b/scripts/gendwarfksyms/kabi.c
index 2d941ee13c9b..35c70a6230d9 100644
--- a/scripts/gendwarfksyms/kabi.c
+++ b/scripts/gendwarfksyms/kabi.c
@@ -87,7 +87,7 @@ struct rule {
};

/* { type, target } -> struct rule */
-static HASHTABLE_DEFINE(rules, 1 << RULE_HASH_BITS);
+static DEFINE_HASHTABLE(rules, 1 << RULE_HASH_BITS);

static inline unsigned int rule_values_hash(enum kabi_rule_type type,
const char *target)
diff --git a/scripts/gendwarfksyms/symbols.c b/scripts/gendwarfksyms/symbols.c
index b4110b0e12ce..a87444611bbd 100644
--- a/scripts/gendwarfksyms/symbols.c
+++ b/scripts/gendwarfksyms/symbols.c
@@ -9,9 +9,9 @@
#define SYMBOL_HASH_BITS 12

/* struct symbol_addr -> struct symbol */
-static HASHTABLE_DEFINE(symbol_addrs, 1 << SYMBOL_HASH_BITS);
+static DEFINE_HASHTABLE(symbol_addrs, 1 << SYMBOL_HASH_BITS);
/* name -> struct symbol */
-static HASHTABLE_DEFINE(symbol_names, 1 << SYMBOL_HASH_BITS);
+static DEFINE_HASHTABLE(symbol_names, 1 << SYMBOL_HASH_BITS);

static inline unsigned int symbol_addr_hash(const struct symbol_addr *addr)
{
diff --git a/scripts/gendwarfksyms/types.c b/scripts/gendwarfksyms/types.c
index 9c3b053bf061..db55c8ae57f8 100644
--- a/scripts/gendwarfksyms/types.c
+++ b/scripts/gendwarfksyms/types.c
@@ -100,7 +100,7 @@ static void type_expansion_append(struct type_expansion *type, const char *s,
* const char *name -> struct type_expansion *
*/
#define TYPE_HASH_BITS 12
-static HASHTABLE_DEFINE(type_map, 1 << TYPE_HASH_BITS);
+static DEFINE_HASHTABLE(type_map, 1 << TYPE_HASH_BITS);

static int __type_map_get(const char *name, struct type_expansion **res)
{
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 83e48670c2fc..01bea2d91d7a 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -24,7 +24,7 @@
#include "genksyms.h"
/*----------------------------------------------------------------------*/

-static HASHTABLE_DEFINE(symbol_hashtable, 1U << 12);
+static DEFINE_HASHTABLE(symbol_hashtable, 1U << 12);
static FILE *debugfile;

int cur_line = 1;
diff --git a/scripts/include/hashtable.h b/scripts/include/hashtable.h
index 45abcb12bfce..fa60976eae37 100644
--- a/scripts/include/hashtable.h
+++ b/scripts/include/hashtable.h
@@ -7,10 +7,10 @@

#define HASH_SIZE(name) (ARRAY_SIZE(name))

-#define HASHTABLE_DECLARE(name, size) struct hlist_head name[size]
+#define DECLARE_HASHTABLE(name, size) struct hlist_head name[size]

-#define HASHTABLE_DEFINE(name, size) \
- HASHTABLE_DECLARE(name, size) = \
+#define DEFINE_HASHTABLE(name, size) \
+ DECLARE_HASHTABLE(name, size) = \
{ [0 ... ((size) - 1)] = HLIST_HEAD_INIT }

#define hash_head(table, key) (&(table)[(key) % HASH_SIZE(table)])
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index ea93016b68d4..5938b775a3fc 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -16,7 +16,7 @@

#define DEBUG_EXPR 0

-HASHTABLE_DEFINE(expr_hashtable, EXPR_HASHSIZE);
+DEFINE_HASHTABLE(expr_hashtable, EXPR_HASHSIZE);

static struct expr *expr_eliminate_yn(struct expr *e);

diff --git a/scripts/kconfig/internal.h b/scripts/kconfig/internal.h
index d0ffce2dfbba..f7e660dbd299 100644
--- a/scripts/kconfig/internal.h
+++ b/scripts/kconfig/internal.h
@@ -6,14 +6,14 @@

#define SYMBOL_HASHSIZE (1U << 14)

-extern HASHTABLE_DECLARE(sym_hashtable, SYMBOL_HASHSIZE);
+extern DECLARE_HASHTABLE(sym_hashtable, SYMBOL_HASHSIZE);

#define for_all_symbols(sym) \
hash_for_each(sym_hashtable, sym, node)

#define EXPR_HASHSIZE (1U << 14)

-extern HASHTABLE_DECLARE(expr_hashtable, EXPR_HASHSIZE);
+extern DECLARE_HASHTABLE(expr_hashtable, EXPR_HASHSIZE);

void expr_invalidate_all(void);

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 27138252c667..e46228d6348e 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -971,7 +971,7 @@ bool sym_is_choice_value(const struct symbol *sym)
return !list_empty(&sym->choice_link);
}

-HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE);
+DEFINE_HASHTABLE(sym_hashtable, SYMBOL_HASHSIZE);

struct symbol *sym_lookup(const char *name, int flags)
{
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index 0809aa061b6a..d2d17d9d37b9 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -14,7 +14,7 @@
#include "lkc.h"

/* hash table of all parsed Kconfig files */
-static HASHTABLE_DEFINE(file_hashtable, 1U << 11);
+static DEFINE_HASHTABLE(file_hashtable, 1U << 11);

struct file {
struct hlist_node node;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 75374c64b8cc..92bcd2b3a08e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -234,7 +234,7 @@ struct symbol {
char name[];
};

-static HASHTABLE_DEFINE(symbol_hashtable, 1U << 10);
+static DEFINE_HASHTABLE(symbol_hashtable, 1U << 10);

/**
* Allocate a new symbols for use in the hash of exported symbols or
--
2.56.0