qcacld-3.0: Fix double create mibstats_lock issue

mibstats_lock is a global variable, current it init
per adapter, so it will fail when init at 2nd time.

Make sure it only create once.

Change-Id: Ia8a57d049fabe311d5b353b5aa612ffa225cbc61
CRs-Fixed: 2643396
This commit is contained in:
Jingxiang Ge 2020-03-18 11:17:41 +08:00 • committed by nshrivas
commit e4f1f2a0e5
4 changed files with 26 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2020 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
@ -49,6 +49,13 @@ void hdd_debugfs_process_mib_stats(struct hdd_adapter *adapter,
*/
int wlan_hdd_create_mib_stats_file(struct hdd_adapter *adapter);
/**
* wlan_hdd_create_mib_stats_lock() - API to create MIB stats lock
*
* Return: No return
*/
void wlan_hdd_create_mib_stats_lock(void);
/**
* wlan_hdd_destroy_mib_stats_lock() - API to destroy MIB stats lock
*
@ -61,6 +68,10 @@ static inline int wlan_hdd_create_mib_stats_file(struct hdd_adapter *adapter)
return 0;
}
static inline void wlan_hdd_create_mib_stats_lock(void)
{
}
static inline void wlan_hdd_destroy_mib_stats_lock(void)
{
}

View file

@ -536,8 +536,10 @@ QDF_STATUS hdd_debugfs_init(struct hdd_adapter *adapter)
adapter->debugfs_phy = debugfs_create_dir(net_dev->name, 0);
if (!adapter->debugfs_phy)
if (!adapter->debugfs_phy) {
hdd_err("debugfs: create folder %s fail", net_dev->name);
return QDF_STATUS_E_FAILURE;
}
if (!debugfs_create_file("wow_pattern", 00400 | 00200,
adapter->debugfs_phy, net_dev,
@ -581,6 +583,5 @@ QDF_STATUS hdd_debugfs_init(struct hdd_adapter *adapter)
void hdd_debugfs_exit(struct hdd_adapter *adapter)
{
debugfs_remove_recursive(adapter->debugfs_phy);
wlan_hdd_destroy_mib_stats_lock();
}
#endif /* #ifdef WLAN_OPEN_SOURCE */

View file

@ -347,15 +347,16 @@ int wlan_hdd_create_mib_stats_file(struct hdd_adapter *adapter)
adapter->dev, &fops_mib_stats))
return -EINVAL;
if (QDF_IS_STATUS_ERROR(qdf_mutex_create(
&mibstats_lock))) {
hdd_debug("mibstats lock init failed!");
return QDF_STATUS_E_FAILURE;
}
return 0;
}
void wlan_hdd_create_mib_stats_lock(void)
{
if (QDF_IS_STATUS_ERROR(qdf_mutex_create(
&mibstats_lock)))
hdd_err("mibstats lock init failed!");
}
void wlan_hdd_destroy_mib_stats_lock(void)
{
qdf_mutex_destroy(&mibstats_lock);

View file

@ -184,6 +184,7 @@
#include "wlan_hdd_btc_chain_mode.h"
#include <wlan_hdd_dcs.h>
#include "wlan_hdd_debugfs_unit_test.h"
#include "wlan_hdd_debugfs_mibstat.h"
#ifdef MODULE
#define WLAN_MODULE_NAME module_name(THIS_MODULE)
@ -6114,7 +6115,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
}
if (QDF_STATUS_SUCCESS != hdd_debugfs_init(adapter))
hdd_err("Interface %s wow debug_fs init failed",
hdd_err("debugfs: Interface %s init failed",
netdev_name(adapter->dev));
hdd_debug("%s interface created. iftype: %d", netdev_name(adapter->dev),
@ -8121,6 +8122,7 @@ void hdd_wlan_exit(struct hdd_context *hdd_ctx)
hdd_enter();
wlan_hdd_destroy_mib_stats_lock();
hdd_debugfs_ini_config_deinit(hdd_ctx);
hdd_debugfs_mws_coex_info_deinit(hdd_ctx);
hdd_psoc_idle_timer_stop(hdd_ctx);
@ -13230,6 +13232,7 @@ int hdd_wlan_startup(struct hdd_context *hdd_ctx)
hdd_debugfs_mws_coex_info_init(hdd_ctx);
hdd_debugfs_ini_config_init(hdd_ctx);
wlan_hdd_debugfs_unit_test_host_create(hdd_ctx);
wlan_hdd_create_mib_stats_lock();
wlan_cfg80211_init_interop_issues_ap(hdd_ctx->pdev);
hdd_exit();