Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
* [PATCH] NTB: Add more than just the first NTB to debugfs
@ 2016-01-13 12:55 Allen Hubbe
  2016-01-18  3:20 ` Jon Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Allen Hubbe @ 2016-01-13 12:55 UTC (permalink / raw)
  To: Dave Jiang; +Cc: linux-ntb, Allen Hubbe

Due to perf_debugfs_setup called only if the top level perf_debugfs_dir
was not created, only the first NTB would be added to debugfs.

Instead, call perf_debugfs_setup for every NTB.  Check that
perf_debugfs_dir exists in perf_debugfs_setup, and if necessary, create
it there.

Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
---

Dave, if you like, you can just fix up your patch with this.

 drivers/ntb/test/ntb_perf.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index dcf903584c43..5d60d59bd2d6 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -636,9 +636,16 @@ static int perf_debugfs_setup(struct perf_ctx *perf)
 {
 	struct pci_dev *pdev = perf->ntb->pdev;
 
-	if (!perf_debugfs_dir)
+	if (!debugfs_initialized())
 		return -ENODEV;
 
+	if (!perf_debugfs_dir) {
+		perf_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
+
+		if (!perf_debugfs_dir)
+			return -ENODEV;
+	}
+
 	perf->debugfs_node_dir = debugfs_create_dir(pci_name(pdev),
 						    perf_debugfs_dir);
 	if (!perf->debugfs_node_dir)
@@ -691,15 +698,9 @@ static int perf_probe(struct ntb_client *client, struct ntb_dev *ntb)
 	ntb_link_enable(ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO);
 	ntb_link_event(ntb);
 
-	if (debugfs_initialized() && !perf_debugfs_dir) {
-		perf_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
-		if (!perf_debugfs_dir)
-			goto err_ctx;
-
-		rc = perf_debugfs_setup(perf);
-		if (rc)
-			goto err_ctx;
-	}
+	rc = perf_debugfs_setup(perf);
+	if (rc)
+		goto err_ctx;
 
 	return 0;
 
-- 
2.5.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-18  3:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-13 12:55 [PATCH] NTB: Add more than just the first NTB to debugfs Allen Hubbe
2016-01-18  3:20 ` Jon Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox