Skip to content

Commit dc898f7

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: move out debugfs init from fwlog
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>
1 parent bf59b53 commit dc898f7

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
909909
}
910910

911911
void ice_debugfs_fwlog_init(struct ice_pf *pf);
912+
int ice_debugfs_pf_init(struct ice_pf *pf);
912913
void ice_debugfs_pf_deinit(struct ice_pf *pf);
913914
void ice_debugfs_init(void);
914915
void ice_debugfs_exit(void);

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,11 @@ static int __fwlog_init(struct ice_hw *hw)
10001000
.send_cmd = __fwlog_send_cmd,
10011001
.priv = hw,
10021002
};
1003+
int err;
1004+
1005+
err = ice_debugfs_pf_init(pf);
1006+
if (err)
1007+
return err;
10031008

10041009
return ice_fwlog_init(hw, &hw->fwlog, &api);
10051010
}
@@ -1179,6 +1184,12 @@ int ice_init_hw(struct ice_hw *hw)
11791184
return status;
11801185
}
11811186

1187+
static void __fwlog_deinit(struct ice_hw *hw)
1188+
{
1189+
ice_debugfs_pf_deinit(hw->back);
1190+
ice_fwlog_deinit(hw, &hw->fwlog);
1191+
}
1192+
11821193
/**
11831194
* ice_deinit_hw - unroll initialization operations done by ice_init_hw
11841195
* @hw: pointer to the hardware structure
@@ -1197,8 +1208,7 @@ void ice_deinit_hw(struct ice_hw *hw)
11971208
ice_free_seg(hw);
11981209
ice_free_hw_tbls(hw);
11991210
mutex_destroy(&hw->tnl_lock);
1200-
1201-
ice_fwlog_deinit(hw, &hw->fwlog);
1211+
__fwlog_deinit(hw);
12021212
ice_destroy_all_ctrlq(hw);
12031213

12041214
/* Clear VSI contexts if not already cleared */

drivers/net/ethernet/intel/ice/ice_debugfs.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,6 @@ static const struct file_operations ice_debugfs_data_fops = {
584584
*/
585585
void ice_debugfs_fwlog_init(struct ice_pf *pf)
586586
{
587-
const char *name = pci_name(pf->pdev);
588587
struct dentry *fw_modules_dir;
589588
struct dentry **fw_modules;
590589
int i;
@@ -601,10 +600,6 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
601600
if (!fw_modules)
602601
return;
603602

604-
pf->ice_debugfs_pf = debugfs_create_dir(name, ice_debugfs_root);
605-
if (IS_ERR(pf->ice_debugfs_pf))
606-
goto err_create_module_files;
607-
608603
pf->ice_debugfs_pf_fwlog = debugfs_create_dir("fwlog",
609604
pf->ice_debugfs_pf);
610605
if (IS_ERR(pf->ice_debugfs_pf_fwlog))
@@ -645,6 +640,17 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
645640
kfree(fw_modules);
646641
}
647642

643+
int ice_debugfs_pf_init(struct ice_pf *pf)
644+
{
645+
const char *name = pci_name(pf->pdev);
646+
647+
pf->ice_debugfs_pf = debugfs_create_dir(name, ice_debugfs_root);
648+
if (IS_ERR(pf->ice_debugfs_pf))
649+
return PTR_ERR(pf->ice_debugfs_pf);
650+
651+
return 0;
652+
}
653+
648654
/**
649655
* ice_debugfs_pf_deinit - cleanup PF's debugfs
650656
* @pf: pointer to the PF struct

drivers/net/ethernet/intel/ice/ice_fwlog.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ void ice_fwlog_deinit(struct ice_hw *hw, struct ice_fwlog *fwlog)
300300
if (hw->bus.func)
301301
return;
302302

303-
ice_debugfs_pf_deinit(hw->back);
304-
305303
/* make sure FW logging is disabled to not put the FW in a weird state
306304
* for the next driver load
307305
*/

0 commit comments

Comments
 (0)