netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, przemyslaw.kitszel@intel.com,
	dawid.osuchowski@linux.intel.com, horms@kernel.org,
	Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Subject: [PATCH iwl-next v2 07/15] ice: move out debugfs init from fwlog
Date: Tue, 12 Aug 2025 06:23:28 +0200	[thread overview]
Message-ID: <20250812042337.1356907-8-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20250812042337.1356907-1-michal.swiatkowski@linux.intel.com>

The root debugfs directory should be available from driver side, not
from library. Move it out from fwlog code.

Make similar to __fwlog_init() __fwlog_deinit() and deinit debugfs
there. In case of ice only fwlog is using debugfs.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice.h         |  1 +
 drivers/net/ethernet/intel/ice/ice_common.c  | 14 ++++++++++++--
 drivers/net/ethernet/intel/ice/ice_debugfs.c | 20 +++++++++++++++-----
 drivers/net/ethernet/intel/ice/ice_fwlog.c   |  2 --
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index a6803b344540..ee2ae0cbc25e 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -909,6 +909,7 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
 }
 
 void ice_debugfs_fwlog_init(struct ice_pf *pf);
+int ice_debugfs_pf_init(struct ice_pf *pf);
 void ice_debugfs_pf_deinit(struct ice_pf *pf);
 void ice_debugfs_init(void);
 void ice_debugfs_exit(void);
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 7b4ff20f3346..9119d097eb08 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1000,6 +1000,11 @@ static int __fwlog_init(struct ice_hw *hw)
 		.send_cmd = __fwlog_send_cmd,
 		.priv = hw,
 	};
+	int err;
+
+	err = ice_debugfs_pf_init(pf);
+	if (err)
+		return err;
 
 	return ice_fwlog_init(hw, &hw->fwlog, &api);
 }
@@ -1179,6 +1184,12 @@ int ice_init_hw(struct ice_hw *hw)
 	return status;
 }
 
+static void __fwlog_deinit(struct ice_hw *hw)
+{
+	ice_debugfs_pf_deinit(hw->back);
+	ice_fwlog_deinit(hw, &hw->fwlog);
+}
+
 /**
  * ice_deinit_hw - unroll initialization operations done by ice_init_hw
  * @hw: pointer to the hardware structure
@@ -1197,8 +1208,7 @@ void ice_deinit_hw(struct ice_hw *hw)
 	ice_free_seg(hw);
 	ice_free_hw_tbls(hw);
 	mutex_destroy(&hw->tnl_lock);
-
-	ice_fwlog_deinit(hw, &hw->fwlog);
+	__fwlog_deinit(hw);
 	ice_destroy_all_ctrlq(hw);
 
 	/* Clear VSI contexts if not already cleared */
diff --git a/drivers/net/ethernet/intel/ice/ice_debugfs.c b/drivers/net/ethernet/intel/ice/ice_debugfs.c
index 9235ae099e17..c7d9e92d7f56 100644
--- a/drivers/net/ethernet/intel/ice/ice_debugfs.c
+++ b/drivers/net/ethernet/intel/ice/ice_debugfs.c
@@ -584,7 +584,6 @@ static const struct file_operations ice_debugfs_data_fops = {
  */
 void ice_debugfs_fwlog_init(struct ice_pf *pf)
 {
-	const char *name = pci_name(pf->pdev);
 	struct dentry *fw_modules_dir;
 	struct dentry **fw_modules;
 	int i;
@@ -601,10 +600,6 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
 	if (!fw_modules)
 		return;
 
-	pf->ice_debugfs_pf = debugfs_create_dir(name, ice_debugfs_root);
-	if (IS_ERR(pf->ice_debugfs_pf))
-		goto err_create_module_files;
-
 	pf->ice_debugfs_pf_fwlog = debugfs_create_dir("fwlog",
 						      pf->ice_debugfs_pf);
 	if (IS_ERR(pf->ice_debugfs_pf_fwlog))
@@ -645,6 +640,21 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
 	kfree(fw_modules);
 }
 
+/**
+ * ice_debugfs_pf_init - create PF's debugfs
+ * @pf: pointer to the PF struct
+ */
+int ice_debugfs_pf_init(struct ice_pf *pf)
+{
+	const char *name = pci_name(pf->pdev);
+
+	pf->ice_debugfs_pf = debugfs_create_dir(name, ice_debugfs_root);
+	if (IS_ERR(pf->ice_debugfs_pf))
+		return PTR_ERR(pf->ice_debugfs_pf);
+
+	return 0;
+}
+
 /**
  * ice_debugfs_pf_deinit - cleanup PF's debugfs
  * @pf: pointer to the PF struct
diff --git a/drivers/net/ethernet/intel/ice/ice_fwlog.c b/drivers/net/ethernet/intel/ice/ice_fwlog.c
index 172905187a3e..f7dbcb5e11aa 100644
--- a/drivers/net/ethernet/intel/ice/ice_fwlog.c
+++ b/drivers/net/ethernet/intel/ice/ice_fwlog.c
@@ -300,8 +300,6 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog)
 	if (hw->bus.func)
 		return;
 
-	ice_debugfs_pf_deinit(hw->back);
-
 	/* make sure FW logging is disabled to not put the FW in a weird state
 	 * for the next driver load
 	 */
-- 
2.49.0


  parent reply	other threads:[~2025-08-12  4:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12  4:23 [PATCH iwl-next v2 00/15] Fwlog support in ixgbe Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 01/15] ice: make fwlog functions static Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 02/15] ice: move get_fwlog_data() to fwlog file Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 03/15] ice: drop ice_pf_fwlog_update_module() Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 04/15] ice: introduce ice_fwlog structure Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 05/15] ice: add pdev into fwlog structure and use it for logging Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 06/15] ice: allow calling custom send function in fwlog Michal Swiatkowski
2025-09-04  4:01   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` Michal Swiatkowski [this message]
2025-09-04  4:02   ` [Intel-wired-lan] [PATCH iwl-next v2 07/15] ice: move out debugfs init from fwlog Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 08/15] ice: check for PF number outside the fwlog code Michal Swiatkowski
2025-09-04  4:03   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 09/15] ice: drop driver specific structure from " Michal Swiatkowski
2025-09-04  4:05   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 10/15] libie, ice: move fwlog admin queue to libie Michal Swiatkowski
2025-09-04  4:08   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 11/15] ice: move debugfs code to fwlog Michal Swiatkowski
2025-08-12  4:23 ` [PATCH iwl-next v2 12/15] ice: prepare for moving file to libie Michal Swiatkowski
2025-09-04  4:08   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 13/15] ice: reregister fwlog after driver reinit Michal Swiatkowski
2025-09-04  4:09   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 14/15] ice, libie: move fwlog code to libie Michal Swiatkowski
2025-09-04  4:10   ` [Intel-wired-lan] " Rinitha, SX
2025-08-12  4:23 ` [PATCH iwl-next v2 15/15] ixgbe: fwlog support for e610 Michal Swiatkowski
2025-09-05  3:43   ` [Intel-wired-lan] " Rinitha, SX
2025-08-26 13:48 ` [PATCH iwl-next v2 00/15] Fwlog support in ixgbe Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250812042337.1356907-8-michal.swiatkowski@linux.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=dawid.osuchowski@linux.intel.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).