qcacmn: Avoid compilation issue with kernel 4.19

There is a compilation issue if a variable is passed to
kernel api DECLARE_HASHTABLE.
TO resolve this issue, instead of passing a variable
pass a constant to DECLARE_HASHTABLE.

Change-Id: Ie9782af541bb34cc50f79060b0007dc73881e5f4
CRs-Fixed: 2386893
This commit is contained in:
Ashish Kumar Dhanotiya
2019-01-21 20:09:29 +05:30
committed by nshrivas
parent ad85c38928
commit 3be335ca19
2 changed files with 10 additions and 5 deletions

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -38,7 +38,9 @@
/** /**
* qdf_ht_declare() - declare a new qdf_ht * qdf_ht_declare() - declare a new qdf_ht
* @name: variable name of the hashtable to declare * @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) #define qdf_ht_declare(name, bits) __qdf_ht_declare(name, bits)

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -20,6 +20,9 @@
#include "qdf_hashtable_test.h" #include "qdf_hashtable_test.h"
#include "qdf_trace.h" #include "qdf_trace.h"
/* 16 buckets */
#define QDF_HT_HASH_BITS 4
struct qdf_ht_test_item { struct qdf_ht_test_item {
struct qdf_ht_entry entry; struct qdf_ht_entry entry;
uintptr_t key; uintptr_t key;
@@ -27,12 +30,12 @@ struct qdf_ht_test_item {
static uint32_t qdf_ht_test_single(void) 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 item = { .key = (uintptr_t)&bits };
struct qdf_ht_test_item *cursor; struct qdf_ht_test_item *cursor;
int i, count; int i, count;
qdf_ht_declare(ht, bits); qdf_ht_declare(ht, QDF_HT_HASH_BITS);
qdf_ht_init(ht); qdf_ht_init(ht);
qdf_ht_add(ht, &item.entry, item.key); qdf_ht_add(ht, &item.entry, item.key);