diff mbox series

[mt76,v2,1/4] wifi: mt76: mt7996: Add per-radio phy debugfs directories.

Message ID 20250430232225.3943242-2-rory@candelatech.com
State New
Headers show
Series wifi: mt76: mt7996: rx filter fixes and improvements. | expand

Commit Message

Rory Little April 30, 2025, 11:22 p.m. UTC
These can be used instead of reporting just from the first phy, or using
one file for all phys, as has been done previously.

Signed-off-by: Rory Little <rory@candelatech.com>
---
 .../wireless/mediatek/mt76/mt7996/debugfs.c   | 25 +++++++++++++++++++
 .../wireless/mediatek/mt76/mt7996/mt7996.h    |  2 ++
 2 files changed, 27 insertions(+)

Comments

kernel test robot May 7, 2025, 6:06 a.m. UTC | #1
Hi Rory,

kernel test robot noticed the following build warnings:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.15-rc5 next-20250506]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Rory-Little/wifi-mt76-mt7996-Add-per-radio-phy-debugfs-directories/20250501-072345
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20250430232225.3943242-2-rory%40candelatech.com
patch subject: [PATCH mt76 v2 1/4] wifi: mt76: mt7996: Add per-radio phy debugfs directories.
config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20250507/202505071352.R4Bb2GN1-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250507/202505071352.R4Bb2GN1-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505071352.R4Bb2GN1-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c: In function 'mt7996_init_debugfs':
>> drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c:851:52: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
     851 |         snprintf(fname, sizeof(fname), "radio_phy%d", phy->mt76->band_idx);
         |                                                    ^
   In function 'mt7996_init_radio_phy_debugfs',
       inlined from 'mt7996_init_debugfs' at drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c:900:9:
   drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c:851:9: note: 'snprintf' output between 11 and 13 bytes into a destination of size 12
     851 |         snprintf(fname, sizeof(fname), "radio_phy%d", phy->mt76->band_idx);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/snprintf +851 drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c

   841	
   842	DEFINE_DEBUGFS_ATTRIBUTE(fops_rf_regval, mt7996_rf_regval_get,
   843				 mt7996_rf_regval_set, "0x%08llx\n");
   844	
   845	static int
   846	mt7996_init_radio_phy_debugfs(struct mt7996_phy *phy)
   847	{
   848		struct dentry *dir;
   849		char fname[12];
   850	
 > 851		snprintf(fname, sizeof(fname), "radio_phy%d", phy->mt76->band_idx);
   852		dir = debugfs_create_dir(fname, phy->dev->debugfs_dir);
   853	
   854		if (IS_ERR_OR_NULL(dir))
   855			return -ENOMEM;
   856	
   857		phy->debugfs_dir = dir;
   858	
   859		return 0;
   860	}
   861
Rory Little May 7, 2025, 8:57 p.m. UTC | #2
> kernel test robot noticed the following build warnings:

My apologies for letting these slip through again. Before I resubmit a 
V3 - in hindsight dumping debugfs additions in with a refactor and two 
bugfixes was probably poor form on my part. Are there any parts of this 
series that are wanted upstream, and should I break those out into 
individual patches?

- Rory
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
index 4a28db17a287..3548b2bd9b72 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
@@ -842,9 +842,28 @@  mt7996_rf_regval_set(void *data, u64 val)
 DEFINE_DEBUGFS_ATTRIBUTE(fops_rf_regval, mt7996_rf_regval_get,
 			 mt7996_rf_regval_set, "0x%08llx\n");
 
+static int
+mt7996_init_radio_phy_debugfs(struct mt7996_phy *phy)
+{
+	struct dentry *dir;
+	char fname[12];
+
+	snprintf(fname, sizeof(fname), "radio_phy%d", phy->mt76->band_idx);
+	dir = debugfs_create_dir(fname, phy->dev->debugfs_dir);
+
+	if (IS_ERR_OR_NULL(dir))
+		return -ENOMEM;
+
+	phy->debugfs_dir = dir;
+
+	return 0;
+}
+
 int mt7996_init_debugfs(struct mt7996_dev *dev)
 {
+	int err;
 	struct dentry *dir;
+	struct mt7996_phy *phy;
 
 	dir = mt76_register_debugfs_fops(&dev->mphy, NULL);
 	if (!dir)
@@ -877,6 +896,12 @@  int mt7996_init_debugfs(struct mt7996_dev *dev)
 
 	dev->debugfs_dir = dir;
 
+	mt7996_for_each_phy(dev, phy) {
+		err = mt7996_init_radio_phy_debugfs(phy);
+		if (err)
+			return err;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
index 43e646ed6094..3300b7c8e4d2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
@@ -296,6 +296,8 @@  struct mt7996_phy {
 
 	bool has_aux_rx;
 	bool counter_reset;
+
+	struct dentry *debugfs_dir;
 };
 
 struct mt7996_dev {