* [net-next PATCH v2 1/3] net: hsr: fix naming of file and functions
2019-04-15 15:36 [net-next PATCH v2 0/3] net: hsr: updates from internal tree Murali Karicheri
@ 2019-04-15 15:36 ` Murali Karicheri
2019-04-15 15:36 ` [net-next PATCH v2 2/3] net: hsr: fix debugfs path to support multiple interfaces Murali Karicheri
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Murali Karicheri @ 2019-04-15 15:36 UTC (permalink / raw)
To: arvid.brodin, davem, netdev, linux-kernel
Fix the file name and functions to match with existing implementation.
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
net/hsr/Makefile | 2 +-
net/hsr/{hsr_prp_debugfs.c => hsr_debugfs.c} | 34 ++++++++++----------
net/hsr/hsr_device.c | 4 +--
net/hsr/hsr_main.h | 8 ++---
4 files changed, 24 insertions(+), 24 deletions(-)
rename net/hsr/{hsr_prp_debugfs.c => hsr_debugfs.c} (74%)
diff --git a/net/hsr/Makefile b/net/hsr/Makefile
index d74d89d013b0..e45757fc477f 100644
--- a/net/hsr/Makefile
+++ b/net/hsr/Makefile
@@ -6,4 +6,4 @@ obj-$(CONFIG_HSR) += hsr.o
hsr-y := hsr_main.o hsr_framereg.o hsr_device.o \
hsr_netlink.o hsr_slave.o hsr_forward.o
-hsr-$(CONFIG_DEBUG_FS) += hsr_prp_debugfs.o
+hsr-$(CONFIG_DEBUG_FS) += hsr_debugfs.o
diff --git a/net/hsr/hsr_prp_debugfs.c b/net/hsr/hsr_debugfs.c
similarity index 74%
rename from net/hsr/hsr_prp_debugfs.c
rename to net/hsr/hsr_debugfs.c
index b30e98734c61..b5a955013976 100644
--- a/net/hsr/hsr_prp_debugfs.c
+++ b/net/hsr/hsr_debugfs.c
@@ -1,5 +1,5 @@
/*
- * hsr_prp_debugfs code
+ * hsr_debugfs code
* Copyright (C) 2017 Texas Instruments Incorporated
*
* Author(s):
@@ -26,9 +26,9 @@ static void print_mac_address(struct seq_file *sfp, unsigned char *mac)
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
-/* hsr_prp_node_table_show - Formats and prints node_table entries */
+/* hsr_node_table_show - Formats and prints node_table entries */
static int
-hsr_prp_node_table_show(struct seq_file *sfp, void *data)
+hsr_node_table_show(struct seq_file *sfp, void *data)
{
struct hsr_priv *priv = (struct hsr_priv *)sfp->private;
struct hsr_node *node;
@@ -52,40 +52,40 @@ hsr_prp_node_table_show(struct seq_file *sfp, void *data)
return 0;
}
-/* hsr_prp_node_table_open - Open the node_table file
+/* hsr_node_table_open - Open the node_table file
*
* Description:
* This routine opens a debugfs file node_table of specific hsr device
*/
static int
-hsr_prp_node_table_open(struct inode *inode, struct file *filp)
+hsr_node_table_open(struct inode *inode, struct file *filp)
{
- return single_open(filp, hsr_prp_node_table_show, inode->i_private);
+ return single_open(filp, hsr_node_table_show, inode->i_private);
}
-static const struct file_operations hsr_prp_fops = {
+static const struct file_operations hsr_fops = {
.owner = THIS_MODULE,
- .open = hsr_prp_node_table_open,
+ .open = hsr_node_table_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
-/* hsr_prp_debugfs_init - create hsr-prp node_table file for dumping
+/* hsr_debugfs_init - create hsr node_table file for dumping
* the node table
*
* Description:
* When debugfs is configured this routine sets up the node_table file per
- * hsr/prp device for dumping the node_table entries
+ * hsr device for dumping the node_table entries
*/
-int hsr_prp_debugfs_init(struct hsr_priv *priv)
+int hsr_debugfs_init(struct hsr_priv *priv)
{
int rc = -1;
struct dentry *de = NULL;
de = debugfs_create_dir("hsr", NULL);
if (!de) {
- pr_err("Cannot create hsr-prp debugfs root\n");
+ pr_err("Cannot create hsr debugfs root\n");
return rc;
}
@@ -93,9 +93,9 @@ int hsr_prp_debugfs_init(struct hsr_priv *priv)
de = debugfs_create_file("node_table", S_IFREG | 0444,
priv->node_tbl_root, priv,
- &hsr_prp_fops);
+ &hsr_fops);
if (!de) {
- pr_err("Cannot create hsr-prp node_table directory\n");
+ pr_err("Cannot create hsr node_table directory\n");
return rc;
}
priv->node_tbl_file = de;
@@ -104,14 +104,14 @@ int hsr_prp_debugfs_init(struct hsr_priv *priv)
return rc;
}
-/* hsr_prp_debugfs_term - Tear down debugfs intrastructure
+/* hsr_debugfs_term - Tear down debugfs intrastructure
*
* Description:
* When Debufs is configured this routine removes debugfs file system
- * elements that are specific to hsr-prp
+ * elements that are specific to hsr
*/
void
-hsr_prp_debugfs_term(struct hsr_priv *priv)
+hsr_debugfs_term(struct hsr_priv *priv)
{
debugfs_remove(priv->node_tbl_file);
priv->node_tbl_file = NULL;
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index b47a621e3f4e..58cf500ebf94 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -354,7 +354,7 @@ static void hsr_dev_destroy(struct net_device *hsr_dev)
hsr = netdev_priv(hsr_dev);
- hsr_prp_debugfs_term(hsr);
+ hsr_debugfs_term(hsr);
rtnl_lock();
hsr_for_each_port(hsr, port)
@@ -485,7 +485,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
goto fail;
mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD));
- res = hsr_prp_debugfs_init(hsr);
+ res = hsr_debugfs_init(hsr);
if (res)
goto fail;
diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index 778213f07fe0..6cd4dff58727 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -184,15 +184,15 @@ static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb)
}
#if IS_ENABLED(CONFIG_DEBUG_FS)
-int hsr_prp_debugfs_init(struct hsr_priv *priv);
-void hsr_prp_debugfs_term(struct hsr_priv *priv);
+int hsr_debugfs_init(struct hsr_priv *priv);
+void hsr_debugfs_term(struct hsr_priv *priv);
#else
-static inline int hsr_prp_debugfs_init(struct hsr_priv *priv)
+static inline int hsr_debugfs_init(struct hsr_priv *priv)
{
return 0;
}
-static inline void hsr_prp_debugfs_term(struct hsr_priv *priv)
+static inline void hsr_debugfs_term(struct hsr_priv *priv)
{}
#endif
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [net-next PATCH v2 2/3] net: hsr: fix debugfs path to support multiple interfaces
2019-04-15 15:36 [net-next PATCH v2 0/3] net: hsr: updates from internal tree Murali Karicheri
2019-04-15 15:36 ` [net-next PATCH v2 1/3] net: hsr: fix naming of file and functions Murali Karicheri
@ 2019-04-15 15:36 ` Murali Karicheri
2019-04-15 15:36 ` [net-next PATCH v2 3/3] net: hsr: add tx stats for master interface Murali Karicheri
2019-04-16 0:22 ` [net-next PATCH v2 0/3] net: hsr: updates from internal tree David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Murali Karicheri @ 2019-04-15 15:36 UTC (permalink / raw)
To: arvid.brodin, davem, netdev, linux-kernel
Fix the path of hsr debugfs root directory to use the net device
name so that it can work with multiple interfaces. While at it,
also fix some typos.
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
net/hsr/hsr_debugfs.c | 11 +++++------
net/hsr/hsr_device.c | 2 +-
net/hsr/hsr_main.h | 5 +++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/hsr/hsr_debugfs.c b/net/hsr/hsr_debugfs.c
index b5a955013976..94447974a3c0 100644
--- a/net/hsr/hsr_debugfs.c
+++ b/net/hsr/hsr_debugfs.c
@@ -1,9 +1,9 @@
/*
* hsr_debugfs code
- * Copyright (C) 2017 Texas Instruments Incorporated
+ * Copyright (C) 2019 Texas Instruments Incorporated
*
* Author(s):
- * Murali Karicheri <m-karicheri2@ti.com?
+ * Murali Karicheri <m-karicheri2@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -78,12 +78,12 @@ static const struct file_operations hsr_fops = {
* When debugfs is configured this routine sets up the node_table file per
* hsr device for dumping the node_table entries
*/
-int hsr_debugfs_init(struct hsr_priv *priv)
+int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev)
{
int rc = -1;
struct dentry *de = NULL;
- de = debugfs_create_dir("hsr", NULL);
+ de = debugfs_create_dir(hsr_dev->name, NULL);
if (!de) {
pr_err("Cannot create hsr debugfs root\n");
return rc;
@@ -99,9 +99,8 @@ int hsr_debugfs_init(struct hsr_priv *priv)
return rc;
}
priv->node_tbl_file = de;
- rc = 0;
- return rc;
+ return 0;
}
/* hsr_debugfs_term - Tear down debugfs intrastructure
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 58cf500ebf94..15c72065df79 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -485,7 +485,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
goto fail;
mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD));
- res = hsr_debugfs_init(hsr);
+ res = hsr_debugfs_init(hsr, hsr_dev);
if (res)
goto fail;
diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index 6cd4dff58727..96fac696a1e1 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -184,10 +184,11 @@ static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb)
}
#if IS_ENABLED(CONFIG_DEBUG_FS)
-int hsr_debugfs_init(struct hsr_priv *priv);
+int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev);
void hsr_debugfs_term(struct hsr_priv *priv);
#else
-static inline int hsr_debugfs_init(struct hsr_priv *priv)
+static inline int hsr_debugfs_init(struct hsr_priv *priv,
+ struct net_device *hsr_dev)
{
return 0;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 5+ messages in thread