mirror of
https://github.com/openwrt/openwrt.git
synced 2025-12-21 17:04:28 +04:00
realtek: mdio-serdes: improve debugfs creation
Commit3c073b5cb2cleaned up the debugfs creation in mdio-realtek-otto-serdes driver to not explicitly check if the root directory already exists. This is fine because kernel handles the case properly so there's no need to check anymore. However, this pollutes the boot log with: [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' [..] debugfs: 'realtek_otto_serdes' already exists in '/' Now, the root directory creation is attempted multiple times, causing the kernel to print an error message because the directory already exists. Fix this by moving the SerDes loop into rtsds_debug_init and only try to create the root debugfs directory once. Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21179 Signed-off-by: Robert Marko <robimarko@gmail.com> (cherry picked from commit8e4730fd60)
This commit is contained in:
committed by
Robert Marko
parent
86ebe649c2
commit
2e56a1ffc6
@@ -142,27 +142,30 @@ static int rtsds_dbg_registers_show(struct seq_file *seqf, void *unused)
|
||||
}
|
||||
DEFINE_SHOW_ATTRIBUTE(rtsds_dbg_registers);
|
||||
|
||||
static int rtsds_debug_init(struct rtsds_ctrl *ctrl, u32 sds)
|
||||
static int rtsds_debug_init(struct rtsds_ctrl *ctrl)
|
||||
{
|
||||
struct rtsds_debug_info *dbg_info;
|
||||
struct dentry *dir, *root;
|
||||
char dirname[32];
|
||||
|
||||
dbg_info = devm_kzalloc(ctrl->dev, sizeof(*dbg_info), GFP_KERNEL);
|
||||
if (!dbg_info)
|
||||
return -ENOMEM;
|
||||
|
||||
dbg_info->ctrl = ctrl;
|
||||
dbg_info->sds = sds;
|
||||
|
||||
root = debugfs_create_dir(RTSDS_DBG_ROOT_DIR, NULL);
|
||||
if (IS_ERR(root))
|
||||
return PTR_ERR(root);
|
||||
|
||||
snprintf(dirname, sizeof(dirname), "serdes.%d", sds);
|
||||
dir = debugfs_create_dir(dirname, root);
|
||||
for (int sds = 0; sds < ctrl->cfg->sds_cnt; sds++) {
|
||||
dbg_info = devm_kzalloc(ctrl->dev, sizeof(*dbg_info), GFP_KERNEL);
|
||||
if (!dbg_info)
|
||||
return -ENOMEM;
|
||||
|
||||
debugfs_create_file("registers", 0600, dir, dbg_info, &rtsds_dbg_registers_fops);
|
||||
dbg_info->ctrl = ctrl;
|
||||
dbg_info->sds = sds;
|
||||
|
||||
snprintf(dirname, sizeof(dirname), "serdes.%d", sds);
|
||||
dir = debugfs_create_dir(dirname, root);
|
||||
|
||||
debugfs_create_file("registers", 0600, dir, dbg_info,
|
||||
&rtsds_dbg_registers_fops);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -461,8 +464,7 @@ static int rtsds_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
for (int sds = 0; sds < ctrl->cfg->sds_cnt; sds++)
|
||||
rtsds_debug_init(ctrl, sds);
|
||||
rtsds_debug_init(ctrl);
|
||||
#endif
|
||||
|
||||
dev_info(dev, "Realtek SerDes mdio bus initialized, %d SerDes, %d pages, %d registers\n",
|
||||
|
||||
Reference in New Issue
Block a user