diff --git a/qdf/inc/qdf_hashtable.h b/qdf/inc/qdf_hashtable.h index f01b5ec2f1..098ee3961c 100644 --- a/qdf/inc/qdf_hashtable.h +++ b/qdf/inc/qdf_hashtable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -38,7 +38,9 @@ /** * qdf_ht_declare() - declare a new qdf_ht * @name: variable name of the hashtable to declare - * @bits: number of hash bits to use; buckets=2^bits + * @bits: number of hash bits to use; buckets=2^bits; Needs to be a compile + * time constant + * */ #define qdf_ht_declare(name, bits) __qdf_ht_declare(name, bits) diff --git a/qdf/test/qdf_hashtable_test.c b/qdf/test/qdf_hashtable_test.c index ce4a15989b..1d1e66ea0e 100644 --- a/qdf/test/qdf_hashtable_test.c +++ b/qdf/test/qdf_hashtable_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -20,6 +20,9 @@ #include "qdf_hashtable_test.h" #include "qdf_trace.h" +/* 16 buckets */ +#define QDF_HT_HASH_BITS 4 + struct qdf_ht_test_item { struct qdf_ht_entry entry; uintptr_t key; @@ -27,12 +30,12 @@ struct qdf_ht_test_item { static uint32_t qdf_ht_test_single(void) { - const int bits = 4; /* 16 buckets */ + const int bits = QDF_HT_HASH_BITS; struct qdf_ht_test_item item = { .key = (uintptr_t)&bits }; struct qdf_ht_test_item *cursor; int i, count; - qdf_ht_declare(ht, bits); + qdf_ht_declare(ht, QDF_HT_HASH_BITS); qdf_ht_init(ht); qdf_ht_add(ht, &item.entry, item.key);