From f5067f066be1cf11f7e55d67b8e88dd26fefce9b Mon Sep 17 00:00:00 2001 From: bings Date: Sat, 21 Mar 2020 21:24:26 +0800 Subject: [PATCH] qcacmn: Return invalid agile detector ID if agile dfs is not supported When QCA_SUPPORT_AGILE_DFS is not defined, dfs->dfs_agile_detector_id will not be set and it will be 0, which is also a meaningful detector id. Currently, if radar_found->detector_id is not set, or set as 0, the detector ID is recognized as a valid agile detector which is incorrect. Return invalid agile detector id if agile dfs is not supported. Change-Id: I259fa6f3f9fbcb4a76567090a8f084e15ee6af93 CRs-Fixed: 2646946 --- umac/dfs/core/src/dfs.h | 11 +++++++++-- umac/dfs/core/src/misc/dfs.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index fe0d4c325d2b..df06567e8ba6 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -412,7 +412,7 @@ * @DETECTOR_ID_2: Detector ID 2 (Agile detector in 80p80MHZ supported devices). * @AGILE_DETECTOR_ID_TRUE_160MHZ: Agile detector ID in true 160MHz devices. * @AGILE_DETECTOR_ID_80p80: Agile detector ID in 80p80MHz supported devices. - * @DETECTOR_ID_MAX: Maximum detector ID value. + * @INVALID_DETECTOR_ID: Invalid detector id. */ enum detector_id { DETECTOR_ID_0, @@ -420,7 +420,7 @@ enum detector_id { DETECTOR_ID_2, AGILE_DETECTOR_ID_TRUE_160MHZ = DETECTOR_ID_1, AGILE_DETECTOR_ID_80P80 = DETECTOR_ID_2, - DETECTOR_ID_MAX, + INVALID_DETECTOR_ID, }; /** @@ -2882,5 +2882,12 @@ static inline bool dfs_is_restricted_80p80mhz_supported(struct wlan_dfs *dfs) * * Return: Agile detector value (uint8_t). */ +#ifdef QCA_SUPPORT_AGILE_DFS uint8_t dfs_get_agile_detector_id(struct wlan_dfs *dfs); +#else +static inline uint8_t dfs_get_agile_detector_id(struct wlan_dfs *dfs) +{ + return INVALID_DETECTOR_ID; +} +#endif #endif /* _DFS_H_ */ diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index ad71a8df1f49..896cfc32e8af 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -978,7 +978,9 @@ bool dfs_is_restricted_80p80mhz_supported(struct wlan_dfs *dfs) } #endif +#ifdef QCA_SUPPORT_AGILE_DFS uint8_t dfs_get_agile_detector_id(struct wlan_dfs *dfs) { return dfs->dfs_agile_detector_id; } +#endif