[PATCH rdma-next] RDMA/hfi1: Use PCI-ID as an identification in debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leon Romanovsky <leonro@xxxxxxxxxxxx>

Update hfi1 to use PCI-IDs as an identification in debugfs, instead
of device name which can be changed after user executes device rename.

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 drivers/infiniband/hw/hfi1/debugfs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c
index 0a557795563c..54b579d8ec07 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.c
+++ b/drivers/infiniband/hw/hfi1/debugfs.c
@@ -1166,23 +1166,24 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
 	char name[sizeof("port0counters") + 1];
 	char link[10];
 	struct hfi1_devdata *dd = dd_from_dev(ibd);
+	struct pci_dev *pdev = dd->pcidev;
 	struct hfi1_pportdata *ppd;
 	int unit = dd->unit;
 	int i, j;

 	if (!hfi1_dbg_root)
 		return;
-	snprintf(name, sizeof(name), "%s_%d", class_name(), unit);
+
 	snprintf(link, sizeof(link), "%d", unit);
-	ibd->hfi1_ibdev_dbg = debugfs_create_dir(name, hfi1_dbg_root);
+	ibd->hfi1_ibdev_dbg = debugfs_create_dir(pci_name(pdev), hfi1_dbg_root);
 	if (!ibd->hfi1_ibdev_dbg) {
-		pr_warn("create of %s failed\n", name);
+		pr_warn("create of %s failed\n", pci_name(pdev));
 		return;
 	}
 	ibd->hfi1_ibdev_link =
-		debugfs_create_symlink(link, hfi1_dbg_root, name);
+		debugfs_create_symlink(link, hfi1_dbg_root, pci_name(pdev));
 	if (!ibd->hfi1_ibdev_link) {
-		pr_warn("create of %s symlink failed\n", name);
+		pr_warn("create of %s symlink failed\n", pci_name(pdev));
 		return;
 	}
 	DEBUGFS_SEQ_FILE_CREATE(opcode_stats, ibd->hfi1_ibdev_dbg, ibd);
--
2.19.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux