summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Jelonek2025-12-16 10:20:13 +0000
committerRobert Marko2025-12-16 12:11:34 +0000
commit8e4730fd60a1b4998d1c9c07aeb6c6a27bce210f (patch)
tree2cb78b69b0f963713771123e7b636b5fc3ed8ce8
parent3045f205b379b160af3b3af16fc976cc216f0248 (diff)
downloadopenwrt-8e4730fd60a1b4998d1c9c07aeb6c6a27bce210f.tar.gz
realtek: mdio-serdes: improve debugfs creation
Commit 3c073b5cb2 cleaned 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>
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c
index 5c8741383f..097fcc41b4 100644
--- a/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c
+++ b/target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto-serdes.c
@@ -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",