From 7195028bb78fbea24dbffb5c8d4ad7d8fdf15426 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Wed, 15 Sep 2021 16:08:57 +0530 Subject: [PATCH] qcacld-3.0: Create dump in progress wifi kobject under feature flag Currently wifi creates kobject for dump in progress feature without any feature flag, since this kobject is for dump is progress feature and there is already feature flag available for this feature so move this code under feature flag. Change-Id: Ib1155194dbec434c3ecd9949514c6c9931e3e661 CRs-Fixed: 3036752 --- .../hdd/inc/wlan_hdd_sysfs_dump_in_progress.h | 21 +++++++++++++---- core/hdd/src/wlan_hdd_sysfs.c | 22 ++---------------- .../hdd/src/wlan_hdd_sysfs_dump_in_progress.c | 23 +++++++++++++++++-- 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_sysfs_dump_in_progress.h b/core/hdd/inc/wlan_hdd_sysfs_dump_in_progress.h index 72f50cadfa..07e0f1987a 100644 --- a/core/hdd/inc/wlan_hdd_sysfs_dump_in_progress.h +++ b/core/hdd/inc/wlan_hdd_sysfs_dump_in_progress.h @@ -30,7 +30,7 @@ * * Return: None */ -void hdd_sysfs_create_dump_in_progress_interface(struct kobject *wifi_kobject); +void hdd_sysfs_create_dump_in_progress_interface(void); /** * hdd_sysfs_destroy_dump_in_progress_interface() - API to destroy @@ -39,14 +39,27 @@ void hdd_sysfs_create_dump_in_progress_interface(struct kobject *wifi_kobject); * * Return: None */ -void hdd_sysfs_destroy_dump_in_progress_interface(struct kobject *wifi_kobject); +void hdd_sysfs_destroy_dump_in_progress_interface(void); + +void hdd_sysfs_create_wifi_root_obj(void); + +void hdd_sysfs_destroy_wifi_root_obj(void); + #else static inline void -hdd_sysfs_create_dump_in_progress_interface(struct kobject *wifi_kobject) +hdd_sysfs_create_dump_in_progress_interface(void) { } static inline void -hdd_sysfs_destroy_dump_in_progress_interface(struct kobject *wifi_kobject) +hdd_sysfs_destroy_dump_in_progress_interface(void) +{ +} + +static inline void hdd_sysfs_create_wifi_root_obj(void) +{ +} + +static inline void hdd_sysfs_destroy_wifi_root_obj(void) { } #endif diff --git a/core/hdd/src/wlan_hdd_sysfs.c b/core/hdd/src/wlan_hdd_sysfs.c index faa718671a..a43dac6565 100644 --- a/core/hdd/src/wlan_hdd_sysfs.c +++ b/core/hdd/src/wlan_hdd_sysfs.c @@ -92,7 +92,6 @@ static struct kobject *wlan_kobject; static struct kobject *driver_kobject; static struct kobject *fw_kobject; static struct kobject *psoc_kobject; -static struct kobject *wifi_kobject; int hdd_sysfs_validate_and_copy_buf(char *dest_buf, size_t dest_buf_size, @@ -563,23 +562,6 @@ static void hdd_sysfs_destroy_version_interface(void) } } -static void hdd_sysfs_create_wifi_root_obj(void) -{ - wifi_kobject = kobject_create_and_add("wifi", NULL); - if (!wifi_kobject) - hdd_err("could not allocate wifi kobject"); -} - -static void hdd_sysfs_destroy_wifi_root_obj(void) -{ - if (!wifi_kobject) { - hdd_err("could not get wifi kobject!"); - return; - } - kobject_put(wifi_kobject); - wifi_kobject = NULL; -} - #ifdef WLAN_POWER_DEBUG static void hdd_sysfs_create_powerstats_interface(void) { @@ -852,7 +834,7 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx) hdd_sysfs_create_wifi_root_obj(); if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) { hdd_sysfs_create_powerstats_interface(); - hdd_sysfs_create_dump_in_progress_interface(wifi_kobject); + hdd_sysfs_create_dump_in_progress_interface(); hdd_sysfs_fw_mode_config_create(driver_kobject); hdd_sysfs_scan_disable_create(driver_kobject); hdd_sysfs_wow_ito_create(driver_kobject); @@ -887,7 +869,7 @@ void hdd_destroy_sysfs_files(void) hdd_sysfs_wow_ito_destroy(driver_kobject); hdd_sysfs_scan_disable_destroy(driver_kobject); hdd_sysfs_fw_mode_config_destroy(driver_kobject); - hdd_sysfs_destroy_dump_in_progress_interface(wifi_kobject); + hdd_sysfs_destroy_dump_in_progress_interface(); hdd_sysfs_destroy_powerstats_interface(); } hdd_sysfs_destroy_wifi_root_obj(); diff --git a/core/hdd/src/wlan_hdd_sysfs_dump_in_progress.c b/core/hdd/src/wlan_hdd_sysfs_dump_in_progress.c index b54855ebd6..e1bbba53ab 100644 --- a/core/hdd/src/wlan_hdd_sysfs_dump_in_progress.c +++ b/core/hdd/src/wlan_hdd_sysfs_dump_in_progress.c @@ -29,6 +29,8 @@ #include "wlan_hdd_sysfs.h" #include "osif_sync.h" +static struct kobject *wifi_kobject; + static ssize_t __hdd_sysfs_dump_in_progress_store(struct hdd_context *hdd_ctx, struct kobj_attribute *attr, @@ -132,7 +134,7 @@ static struct kobj_attribute dump_in_progress_attribute = __ATTR(dump_in_progress, 0660, hdd_sysfs_dump_in_progress_show, hdd_sysfs_dump_in_progress_store); -void hdd_sysfs_create_dump_in_progress_interface(struct kobject *wifi_kobject) +void hdd_sysfs_create_dump_in_progress_interface(void) { int error; @@ -146,7 +148,7 @@ void hdd_sysfs_create_dump_in_progress_interface(struct kobject *wifi_kobject) hdd_err("could not create dump in progress sysfs file"); } -void hdd_sysfs_destroy_dump_in_progress_interface(struct kobject *wifi_kobject) +void hdd_sysfs_destroy_dump_in_progress_interface(void) { if (!wifi_kobject) { hdd_err("could not get wifi kobject!"); @@ -157,3 +159,20 @@ void hdd_sysfs_destroy_dump_in_progress_interface(struct kobject *wifi_kobject) &dump_in_progress_attribute.attr); } +void hdd_sysfs_create_wifi_root_obj(void) +{ + wifi_kobject = kobject_create_and_add("wifi", NULL); + if (!wifi_kobject) + hdd_err("could not allocate wifi kobject"); +} + +void hdd_sysfs_destroy_wifi_root_obj(void) +{ + if (!wifi_kobject) { + hdd_err("could not get wifi kobject!"); + return; + } + kobject_put(wifi_kobject); + wifi_kobject = NULL; +} +