From 24b8e12778bb499498a8fb024a1a651912dcfec9 Mon Sep 17 00:00:00 2001 From: Krupali Dhanvijay Date: Wed, 30 Aug 2023 16:58:22 +0530 Subject: [PATCH] qcacmn: Cleanup reg_cache_channel_state Cleanup reg_cache_channel_state and the related code with it. Also, changed the logic so as to compare channel freq instead of channel number in reg_modify_chan_list_for_cached_channels() Change-Id: I424b6886ed18f73bae0d2b36e36a9ddc1819688b CRs-Fixed: 2908016 (cherry picked from commit e5958f59298fec88a176a98ba43e31f7720ad16e) --- .../regulatory/core/src/reg_build_chan_list.c | 6 +- umac/regulatory/core/src/reg_utils.c | 57 ------------------- umac/regulatory/core/src/reg_utils.h | 23 +------- .../dispatcher/inc/wlan_reg_ucfg_api.h | 22 +------ .../dispatcher/src/wlan_reg_ucfg_api.c | 16 +----- 5 files changed, 6 insertions(+), 118 deletions(-) diff --git a/umac/regulatory/core/src/reg_build_chan_list.c b/umac/regulatory/core/src/reg_build_chan_list.c index f6e70bd26ead..825d03469a52 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.c +++ b/umac/regulatory/core/src/reg_build_chan_list.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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 @@ -732,8 +732,8 @@ static void reg_modify_chan_list_for_cached_channels( if (pdev_priv_obj->disable_cached_channels) { for (i = 0; i < num_cache_channels; i++) for (j = 0; j < NUM_CHANNELS; j++) - if (cache_chan_list[i].chan_num == - chan_list[j].chan_num) { + if (cache_chan_list[i].center_freq == + chan_list[j].center_freq) { chan_list[j].state = CHANNEL_STATE_DISABLE; chan_list[j].chan_flags |= diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 2a162c13bd52..207f8c1ea595 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -686,63 +686,6 @@ QDF_STATUS reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_SUCCESS; } #endif /* CONFIG_CHAN_FREQ_API */ - -#ifdef CONFIG_CHAN_NUM_API -QDF_STATUS reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels) -{ - struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; - struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; - struct wlan_objmgr_psoc *psoc; - uint8_t i, j; - - pdev_priv_obj = reg_get_pdev_obj(pdev); - - if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { - reg_err("pdev reg component is NULL"); - return QDF_STATUS_E_INVAL; - } - - psoc = wlan_pdev_get_psoc(pdev); - if (!psoc) { - reg_err("psoc is NULL"); - return QDF_STATUS_E_INVAL; - } - - psoc_priv_obj = reg_get_psoc_obj(psoc); - if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) { - reg_err("psoc reg component is NULL"); - return QDF_STATUS_E_INVAL; - } - if (pdev_priv_obj->num_cache_channels > 0) { - pdev_priv_obj->num_cache_channels = 0; - qdf_mem_zero(&pdev_priv_obj->cache_disable_chan_list, - sizeof(pdev_priv_obj->cache_disable_chan_list)); - } - - for (i = 0; i < num_channels; i++) { - for (j = 0; j < NUM_CHANNELS; j++) { - if (channel_list[i] == pdev_priv_obj-> - cur_chan_list[j].chan_num) { - pdev_priv_obj-> - cache_disable_chan_list[i].chan_num = - channel_list[i]; - pdev_priv_obj-> - cache_disable_chan_list[i].state = - pdev_priv_obj->cur_chan_list[j].state; - pdev_priv_obj-> - cache_disable_chan_list[i].chan_flags = - pdev_priv_obj-> - cur_chan_list[j].chan_flags; - } - } - } - pdev_priv_obj->num_cache_channels = num_channels; - - return QDF_STATUS_SUCCESS; -} -#endif /* CONFIG_CHAN_NUM_API */ #endif #ifdef CONFIG_REG_CLIENT diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index fdb8a834a28d..e151a8fd3b94 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -175,27 +175,6 @@ QDF_STATUS reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev, } #endif /* defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_FREQ_API) */ -#if defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_NUM_API) -/** - * reg_cache_channel_state() - Cache the current state of the channels - * @pdev: The physical dev to cache the channels for - * @channel_list: List of the channels for which states needs to be cached - * @num_channels: Number of channels in the list - * - */ -QDF_STATUS reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels); -#else -static inline -QDF_STATUS reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels) -{ - return QDF_STATUS_SUCCESS; -} -#endif /* defined (DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_NUM_API) */ - #ifdef CONFIG_REG_CLIENT /** * reg_set_band() - Sets the band information for the PDEV diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index eafd72b5ce19..2d8e636bcd28 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -61,27 +62,6 @@ QDF_STATUS ucfg_reg_get_band(struct wlan_objmgr_pdev *pdev, QDF_STATUS ucfg_reg_notify_sap_event(struct wlan_objmgr_pdev *pdev, bool sap_state); -/** - * ucfg_reg_cache_channel_state() - Cache the current state of the channles - * @pdev: The physical dev to cache the channels for - * @channel_list: List of the channels for which states needs to be cached - * @num_channels: Number of channels in the list - * - * Return: QDF_STATUS - */ -#if defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_NUM_API) -void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels); -#else -static inline -void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels) -{ -} -#endif /* CONFIG_CHAN_NUM_API */ - /** * ucfg_reg_cache_channel_freq_state() - Cache the current state of the * channels based on the channel center frequency. diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index b544dc0bd212..28dfc349a055 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -311,21 +312,6 @@ void ucfg_reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev, } #endif /* CONFIG_CHAN_FREQ_API */ -#ifdef CONFIG_CHAN_NUM_API -/** - * ucfg_reg_cache_channel_state() - Cache the current state of the channles - * @pdev: The physical dev to cache the channels for - * @channel_list: List of the channels for which states needs to be cached - * @num_channels: Number of channels in the list - * - */ -void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, uint32_t num_channels) -{ - reg_cache_channel_state(pdev, channel_list, num_channels); -} -#endif /* CONFIG_CHAN_NUM_API */ - void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev) { reg_restore_cached_channels(pdev);