Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1385361pxb; Wed, 10 Feb 2021 07:17:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOTMugVfr6mTHybUHKdUaUAvEAfb/RR95TnWgONZ71eXRaiEp61IDePjZpbEFaA07frrAR X-Received: by 2002:a17:906:c10a:: with SMTP id do10mr3383959ejc.543.1612970222959; Wed, 10 Feb 2021 07:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612970222; cv=none; d=google.com; s=arc-20160816; b=KEIpUuLYrHv9mHUpMjeIKzFmAkwNa0T24pcUI+CEhUd1EKDagjk0ik4NjdhVhfF3lh oZBeV7LuA6uo5w3q9yQv9AFQ81aRQD5kaZQws2Mt/XEUMZnQI0RkXbGcF3sXIVCUfhnU YFRYnXGPHsKIFFmdpeanb5/CZgRJix43+/J2TagzyaT0n4ZhXnTygNiSGhwdKZiUd9eb 3fM42uN7A87yxEQVUAkBsdFZPa3H9jMDYuX+9e1Od9uyE0HYevJxriUWKlgEXKUAva45 YciuSJ3ESoModBOt0Ce+yHvB2+SQkMOeB06r9s2LI9+7jfYvt+G3PZaf1MDL9gDnNKYu t8Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=OEQqiylYIEUT5Zc6UTt/9KrkOiioHkwrBjBahfp0AWg=; b=ZVioNSvcb5m58d6pC1kSaxeVLHsKZjV0dRpMdtNABQdaABe6l5l1ueFHtWgMtEYxDR 0zDZIYEOA0GFhcrAy6+O7cVYjbn4+T2mFOWGGqIFcxxAJAX+GkQlRJjxtZzelAUfbNw+ zpR2IOxPJv+T9xcMHfTWu9A3eR5fSo7v0JDarxk83n+HTMznjFDmD8vyUPbC7ScvTGeS ieI+1GyIadm5ee5eIu7CT4VIkKv7hZJSmCehJVEcVnw4bDZpSqx4CcSieTqXGBKLna5k U2ArPLYgQNU8PojU/QeoPU6A/tVaQCb9OfNdP8KXfkWI0G195mUwuoM2C+DpM2IENGRd CoPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si1518686edc.573.2021.02.10.07.16.39; Wed, 10 Feb 2021 07:17:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231817AbhBJPQL (ORCPT + 99 others); Wed, 10 Feb 2021 10:16:11 -0500 Received: from paleale.coelho.fi ([176.9.41.70]:45250 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231626AbhBJPQH (ORCPT ); Wed, 10 Feb 2021 10:16:07 -0500 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l9rD4-0049kS-H9; Wed, 10 Feb 2021 17:15:18 +0200 From: Luca Coelho To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Date: Wed, 10 Feb 2021 17:15:06 +0200 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210210151514.416221-1-luca@coelho.fi> References: <20210210151514.416221-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.4 Subject: [PATCH 04/12] iwlwifi: mvm: simplify iwl_mvm_dbgfs_register Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Emmanuel Grumbach No need to pass the dbgfs_dir just to assign it to mvm. Assign to mvm and then call iwl_mvm_dbgfs_register. This is a preparation towards the addition of a delayed op_mode_start flow. This will allow to split the op_mode_start flow. Registration to debugfs must happen after we register to mac80211 and the registration to mac80211 will soon be delayed in certain cases. In order not to have to remember the debugfs_dir in a separate variable, just set it into the mvm structure so that it can be usable later. Declare mvm->debugfs_dir in the iwl_mvm structure even when IWLWIFI_DEBUGFS isn't enabled to simplify the source code. Signed-off-by: Emmanuel Grumbach Signed-off-by: Luca Coelho --- .../net/wireless/intel/iwlwifi/mvm/debugfs.c | 25 +++++++++---------- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 11 +++++--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 ++- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index 90143b16e665..130760572262 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c @@ -2037,26 +2037,24 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw, MVM_DEBUGFS_ADD_STA_FILE(amsdu_len, dir, 0600); } -void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) +void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) { struct dentry *bcast_dir __maybe_unused; char buf[100]; spin_lock_init(&mvm->drv_stats_lock); - mvm->debugfs_dir = dbgfs_dir; - MVM_DEBUGFS_ADD_FILE(tx_flush, mvm->debugfs_dir, 0200); MVM_DEBUGFS_ADD_FILE(sta_drain, mvm->debugfs_dir, 0200); MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, 0600); MVM_DEBUGFS_ADD_FILE(set_nic_temperature, mvm->debugfs_dir, 0600); - MVM_DEBUGFS_ADD_FILE(nic_temp, dbgfs_dir, 0400); - MVM_DEBUGFS_ADD_FILE(ctdp_budget, dbgfs_dir, 0400); - MVM_DEBUGFS_ADD_FILE(stop_ctdp, dbgfs_dir, 0200); - MVM_DEBUGFS_ADD_FILE(force_ctkill, dbgfs_dir, 0200); - MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, 0400); - MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, 0400); - MVM_DEBUGFS_ADD_FILE(bt_cmd, dbgfs_dir, 0400); + MVM_DEBUGFS_ADD_FILE(nic_temp, mvm->debugfs_dir, 0400); + MVM_DEBUGFS_ADD_FILE(ctdp_budget, mvm->debugfs_dir, 0400); + MVM_DEBUGFS_ADD_FILE(stop_ctdp, mvm->debugfs_dir, 0200); + MVM_DEBUGFS_ADD_FILE(force_ctkill, mvm->debugfs_dir, 0200); + MVM_DEBUGFS_ADD_FILE(stations, mvm->debugfs_dir, 0400); + MVM_DEBUGFS_ADD_FILE(bt_notif, mvm->debugfs_dir, 0400); + MVM_DEBUGFS_ADD_FILE(bt_cmd, mvm->debugfs_dir, 0400); MVM_DEBUGFS_ADD_FILE(disable_power_off, mvm->debugfs_dir, 0600); MVM_DEBUGFS_ADD_FILE(fw_ver, mvm->debugfs_dir, 0400); MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, 0400); @@ -2079,7 +2077,7 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) if (mvm->fw->phy_integration_ver) MVM_DEBUGFS_ADD_FILE(phy_integration_ver, mvm->debugfs_dir, 0400); #ifdef CONFIG_ACPI - MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, 0400); + MVM_DEBUGFS_ADD_FILE(sar_geo_profile, mvm->debugfs_dir, 0400); #endif MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0600); @@ -2131,12 +2129,13 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) debugfs_create_blob("nvm_reg", S_IRUSR, mvm->debugfs_dir, &mvm->nvm_reg_blob); - debugfs_create_file("mem", 0600, dbgfs_dir, mvm, &iwl_dbgfs_mem_ops); + debugfs_create_file("mem", 0600, mvm->debugfs_dir, mvm, + &iwl_dbgfs_mem_ops); /* * Create a symlink with mac80211. It will be removed when mac80211 * exists (before the opmode exists which removes the target.) */ - snprintf(buf, 100, "../../%pd2", dbgfs_dir->d_parent); + snprintf(buf, 100, "../../%pd2", mvm->debugfs_dir->d_parent); debugfs_create_symlink("iwlwifi", mvm->hw->wiphy->debugfsdir, buf); } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 8bc1d8dea432..0a963d01b825 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -893,8 +893,12 @@ struct iwl_mvm { /* last smart fifo state that was successfully sent to firmware */ enum iwl_sf_state sf_state; -#ifdef CONFIG_IWLWIFI_DEBUGFS + /* + * Leave this pointer outside the ifdef below so that it can be + * assigned without ifdef in the source code. + */ struct dentry *debugfs_dir; +#ifdef CONFIG_IWLWIFI_DEBUGFS u32 dbgfs_sram_offset, dbgfs_sram_len; u32 dbgfs_prph_reg_addr; bool disable_power_off; @@ -1700,12 +1704,11 @@ void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, /* MVM debugfs */ #ifdef CONFIG_IWLWIFI_DEBUGFS -void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir); +void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm); void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif); void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif); #else -static inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, - struct dentry *dbgfs_dir) +static inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) { } static inline void diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 573c4548e441..a690f3a67d7c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -907,7 +907,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, goto out_thermal_exit; mvm->hw_registered = true; - iwl_mvm_dbgfs_register(mvm, dbgfs_dir); + mvm->debugfs_dir = dbgfs_dir; + iwl_mvm_dbgfs_register(mvm); return op_mode; -- 2.30.0