stmmac: debugfs entry name is not be changed when udev rename device name.
Subsystems (4)
PATCH 1/1 stmmac: debugfs entry name is not be changed when udev rename device name.
Add one notifier for udev changes net device name.
--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +37 -1
@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) }DEFINE_SHOW_ATTRIBUTE (stmmac_dma_cap); +/** +* Use network device events to create/remove/rename +* debugfs file entries +*/ +static int stmmac_device_event (struct notifier_block *unused, +unsigned long event,void *ptr) +{ +struct net_device *dev =netdev_notifier_info_to_dev (ptr); +struct stmmac_priv *priv =netdev_priv (dev); + +switch (event) { +case NETDEV_CHANGENAME : +if (priv->dbgfs_dir) + priv->dbgfs_dir =debugfs_rename (stmmac_fs_dir, + priv->dbgfs_dir, + stmmac_fs_dir, + dev->name); +break ; + +case NETDEV_GOING_DOWN : +break ; + +case NETDEV_UP : +break ; + } + +done: +return NOTIFY_DONE ; +} + +static struct notifier_block stmmac_notifier = { + .notifier_call = stmmac_device_event, +}; +static int stmmac_init_fs (struct net_device *dev) {struct stmmac_priv *priv =netdev_priv (dev);
@@ -4050,7 +4084,6 @@ static int stmmac_init_fs(struct net_device *dev)return -ENOMEM ; } -/* Entry to report DMA RX/TX rings */ priv->dbgfs_rings_status = debugfs_create_file("descriptors_status", 0444,
@@ -4076,6 +4109,8 @@ static int stmmac_init_fs(struct net_device *dev)return -ENOMEM ; } +register_netdevice_notifier (&stmmac_notifier); +return 0 ; }
@@ -4083,6 +4118,7 @@ static void stmmac_exit_fs(struct net_device *dev) {struct stmmac_priv *priv =netdev_priv (dev); +unregister_netdevice_notifier (&stmmac_notifier);debugfs_remove_recursive (priv->dbgfs_dir); }#endif /* CONFIG_DEBUG_FS */
Signature · 1 line
2.23.0
Hi,
Quoted 12 lines · Jiping Ma
Add one notifier for udev changes net device name.
Signed-off-by Jiping Ma <[email protected]>--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4041
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1
-0@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) }DEFINE_SHOW_ATTRIBUTE (stmmac_dma_cap); +/**
Just use /* here since this is not a kernel-doc comment. /** is reserved for kernel-doc comments/notation.
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6
-0+* Use network device events to create/remove/rename +* debugfs file entries +*/ +static int stmmac_device_event (struct notifier_block *unused, +unsigned long event,void *ptr) +{
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_init_fs(struct net_device *dev) · line 4089
Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-1@@ -4050,7 +4084,6 @@ static int stmmac_init_fs(struct net_device *dev)return -ENOMEM ; } -/* Entry to report DMA RX/TX rings */ priv->dbgfs_rings_status = debugfs_create_file("descriptors_status", 0444,
I don't see a problem with the blank line. Why remove it?
thanks.
Signature · 1 line
~Randy
Quoted 18 lines · Randy Dunlap
Hi,
Quoted 15 lines · Jiping Ma
Add one notifier for udev changes net device name.
Signed-off-by Jiping Ma <[email protected]>--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) }DEFINE_SHOW_ATTRIBUTE (stmmac_dma_cap);
Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4041
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1
-0+/** Just use /* here since this is not a kernel-doc comment. /** is reserved for kernel-doc comments/notation.
I use checkpatch.pl to check my patch, it show one warning, then I change * to **. I will change it back to *.
WARNING: networking block comments don't use an empty /* line, use /* Comment...
#23: FILE: drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:4042:
+/*
+ * Use network device events to create/remove/rename
Quoted 10 lines
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6
-0+* Use network device events to create/remove/rename +* debugfs file entries +*/ +static int stmmac_device_event (struct notifier_block *unused, +unsigned long event,void *ptr) +{@@ -4050,7 +4084,6 @@ static int stmmac_init_fs(struct net_device *dev)
Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_init_fs(struct net_device *dev) · line 4089
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-1return -ENOMEM ; } -/* Entry to report DMA RX/TX rings */ priv->dbgfs_rings_status = debugfs_create_file("descriptors_status", 0444,I don't see a problem with the blank line. Why remove it?
I will change it back.
Quoted 3 lines
thanks.
Quoted 23 lines · Jiping Ma
Quoted 10 lines · Randy Dunlap
Hi,
Quoted 7 lines · Jiping Ma
Add one notifier for udev changes net device name.
Signed-off-by Jiping Ma <[email protected]>---
.../net/ethernet/stmicro/stmmac/stmmac_main.c| 38 ++++++++++++++++++-1 file changed, 37 insertions(+), 1 deletion(-)Quoted 10 lines
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) } DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap);+/**
Just use /* here since this is not a kernel-doc comment. /** is reserved for kernel-doc comments/notation.
Quoted 1 line
I use checkpatch.pl to check my patch, it show one warning, then I change * to **. I will change it back to *.
It should be more like:
/* Use network device events to create/remove/rename
* debugfs file entries.
*/
Quoted 12 lines
WARNING: networking block comments don't use an empty /* line, use /* Comment... #23: FILE:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:4042:
+/*
+ * Use network device events to create/remove/renameQuoted 8 lines
Quoted 7 lines
+ * Use network device events to create/remove/rename
+ * debugfs file entries
+ */drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3
-0+static int stmmac_device_event (struct notifier_block *unused, + unsigned long event, void *ptr) +{
Signature · 2 lines
~Randy Reported-by: Randy Dunlap <[email protected]>
Quoted 23 lines · Randy Dunlap
Quoted 22 lines · Jiping Ma
Quoted 20 lines · Randy Dunlap
Hi,
Quoted 12 lines · Jiping Ma
Add one notifier for udev changes net device name.
Signed-off-by Jiping Ma <[email protected]>--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4040
Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) } DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap); +/**Just use /* here since this is not a kernel-doc comment. /** is reserved for kernel-doc comments/notation.
Quoted 7 lines
Quoted 1 line
I use checkpatch.pl to check my patch, it show one warning, then I change * to **. I will change it back to *.
It should be more like:
/* Use network device events to create/remove/rename
* debugfs file entries.
*/
Got it. Thanks.
Quoted 11 lines
Quoted 10 lines
WARNING: networking block comments don't use an empty /* line, use /* Comment... #23: FILE:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:4042:
+/*
+ * Use network device events to create/remove/renameQuoted 6 lines
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6
-0+* Use network device events to create/remove/rename +* debugfs file entries +*/ +static int stmmac_device_event (struct notifier_block *unused, + unsigned long event, void *ptr) +{
Hello!
Quoted 29 lines · Jiping Ma
Add one notifier for udev changes net device name.
Signed-off-by Jiping Ma <[email protected]>--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +14
-0@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) }DEFINE_SHOW_ATTRIBUTE (stmmac_dma_cap); +/** +* Use network device events to create/remove/rename +* debugfs file entries +*/ +static int stmmac_device_event (struct notifier_block *unused, +unsigned long event,void *ptr) +{ +struct net_device *dev =netdev_notifier_info_to_dev (ptr); +struct stmmac_priv *priv =netdev_priv (dev); + +switch (event) { +case NETDEV_CHANGENAME : +if (priv->dbgfs_dir) + priv->dbgfs_dir = debugfs_rename(stmmac_fs_dir,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4064
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +10
-0+ priv->dbgfs_dir, + stmmac_fs_dir, + dev->name); +break ; + +case NETDEV_GOING_DOWN : +break ; + +case NETDEV_UP : +break ;
Why not merge the above 2 cases? Or just remove them('event' is not *enum*)?
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4069
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5
-0+ } + +done: +return NOTIFY_DONE ; +}
[...]
MBR, Sergei
Quoted 37 lines · Sergei Shtylyov
Hello!
Quoted 33 lines · Jiping Ma
Add one notifier for udev changes net device name.
Signed-off-by Jiping Ma <[email protected]>---
.../net/ethernet/stmicro/stmmac/stmmac_main.c| 38 ++++++++++++++++++-1 file changed, 37 insertions(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -4038,6 +4038,40 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) } DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap);+/**
+ * Use network device events to create/remove/rename
+ * debugfs file entries
+ */drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +14
-0+static int stmmac_device_event (struct notifier_block *unused, + unsigned long event, void *ptr) +{ + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct stmmac_priv *priv = netdev_priv(dev); + + switch (event) { + case NETDEV_CHANGENAME: + if (priv->dbgfs_dir) + priv->dbgfs_dir = debugfs_rename(stmmac_fs_dir, + priv->dbgfs_dir, + stmmac_fs_dir, + dev->name); + break;
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4064
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6
-0+ + case NETDEV_GOING_DOWN: + break; + + case NETDEV_UP: + break;Why not merge the above 2 cases? Or just remove
them('event' is not *enum*)?
I will remove them.
Thanks,
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_dma_cap_show(struct seq_file *seq, void *v) · line 4069
Quoted 6 lines
+ }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4
-0+ +done: + return NOTIFY_DONE; +}[...]
MBR, Sergei