]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ice: move out debugfs init from fwlog
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tue, 12 Aug 2025 04:23:28 +0000 (06:23 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 11 Sep 2025 19:09:58 +0000 (12:09 -0700)
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>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice.h
drivers/net/ethernet/intel/ice/ice_common.c
drivers/net/ethernet/intel/ice/ice_debugfs.c
drivers/net/ethernet/intel/ice/ice_fwlog.c

index a6803b3445407a0db378df8a18d6455519deac10..ee2ae0cbc25e7739c98e604d42af1a18efec4412 100644 (file)
@@ -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);
index 53d713d19da244a5bccb5d17c10e3e7b7ee9576d..16765c2da4bd4a1b9921de5d68cd3acd53348a61 100644 (file)
@@ -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 @@ err_unroll_cqinit:
        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 */
index 9235ae099e17422f9fea3c751e9650e328d02503..b9849d1ef92889a1636479b0855cec41c3949536 100644 (file)
@@ -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,17 @@ err_create_module_files:
        kfree(fw_modules);
 }
 
+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
index 172905187a3e71bb232b4cff096490956b84b239..f7dbcb5e11aaa0ea9e1e55383ffce11bbc12907b 100644 (file)
@@ -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
         */