From b4886c4ece3e692c294aa853da7aec849f8d00a2 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Sat, 25 Jan 2025 23:55:53 +0000 Subject: rtw88/rtw89: avoid duplicate top-level directory with debugfs If people like me having multiple cards in the same system creating the debugfs dirctory leads to a panic upon attaching the 2nd card due to the duplicate name. Rather than using the hard coded driver name, use the device name (e.g., rtw880, rtw881, rtw882). This solves two issues: it avoids the duplicate name and we get individual debugging/statistic information for each card. Sponsored by: The FreeBSD Foundation MFC after: 3 days X-Note: ath1[01]k and mt76 likely will need a similar change --- sys/contrib/dev/rtw88/debug.c | 4 ++++ sys/contrib/dev/rtw89/debug.c | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'sys') diff --git a/sys/contrib/dev/rtw88/debug.c b/sys/contrib/dev/rtw88/debug.c index e84f25b34c46..1373633d73ee 100644 --- a/sys/contrib/dev/rtw88/debug.c +++ b/sys/contrib/dev/rtw88/debug.c @@ -1223,7 +1223,11 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev) { struct dentry *debugfs_topdir; +#if defined(__linux__) debugfs_topdir = debugfs_create_dir("rtw88", +#elif defined(__FreeBSD__) + debugfs_topdir = debugfs_create_dir(dev_name(rtwdev->dev), +#endif rtwdev->hw->wiphy->debugfsdir); rtw_debugfs_add_w(write_reg); rtw_debugfs_add_rw(read_reg); diff --git a/sys/contrib/dev/rtw89/debug.c b/sys/contrib/dev/rtw89/debug.c index 750ef1578e18..a87f4b49829d 100644 --- a/sys/contrib/dev/rtw89/debug.c +++ b/sys/contrib/dev/rtw89/debug.c @@ -3974,7 +3974,11 @@ void rtw89_debugfs_init(struct rtw89_dev *rtwdev) { struct dentry *debugfs_topdir; +#if defined(__linux__) debugfs_topdir = debugfs_create_dir("rtw89", +#elif defined(__FreeBSD__) + debugfs_topdir = debugfs_create_dir(dev_name(rtwdev->dev), +#endif rtwdev->hw->wiphy->debugfsdir); rtw89_debugfs_add_rw(read_reg); -- cgit v1.3