diff mbox

[01/14] mt76: fix debugfs_simple_attr.cocci warnings

Message ID 20171214153918.43774-2-nbd@nbd.name (mailing list archive)
State Accepted
Commit 1a2b3666da582f93635a9c7be663d8100b9a303f
Delegated to: Kalle Valo
Headers show

Commit Message

Felix Fietkau Dec. 14, 2017, 3:39 p.m. UTC
From: Fengguang Wu <fengguang.wu@intel.com>

drivers/net/wireless/mediatek/mt76/debugfs.c:36:0-23: WARNING: fops_regval should be defined with DEFINE_DEBUGFS_ATTRIBUTE

 Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
 for debugfs files.

Semantic patch information:
 Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
 imposes some significant overhead as compared to
 DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Fixes: a5f6039c8f9c ("mt76: add driver code for MT76x2e")
CC: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 drivers/net/wireless/mediatek/mt76/debugfs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Kalle Valo Jan. 8, 2018, 5:26 p.m. UTC | #1
Felix Fietkau <nbd@nbd.name> wrote:

> From: Fengguang Wu <fengguang.wu@intel.com>
> 
> drivers/net/wireless/mediatek/mt76/debugfs.c:36:0-23: WARNING: fops_regval should be defined with DEFINE_DEBUGFS_ATTRIBUTE
> 
>  Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
>  for debugfs files.
> 
> Semantic patch information:
>  Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
>  imposes some significant overhead as compared to
>  DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
> 
> Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
> 
> Fixes: a5f6039c8f9c ("mt76: add driver code for MT76x2e")
> CC: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

10 patches applied to wireless-drivers-next.git, thanks.

1a2b3666da58 mt76: fix debugfs_simple_attr.cocci warnings
34152a809d8c mt76: fix returnvar.cocci warnings
c2d4c8723dbf mt76x2: remove some harmless WARN_ONs in tx status and rx path
ed6b43708116 mt76x2: increase OFDM SIFS time
60e2434c5f5a mt76x2: add channel argument to eeprom tx power functions
984ea50324ec mt76x2: initialize channel power limits at probe time
53aa29b274ba mt76x2: convert between per-chain tx power and combined output
eb46e5b7be0d mt76x2: init: disable APCLI by default
e8be626d794b mt76x2: configure rx filter based on monitor mode setting
a86af66f9b0c mt76x2: init: fix rx filter default value during init
diff mbox

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/debugfs.c b/drivers/net/wireless/mediatek/mt76/debugfs.c
index 7c3612aaa8c4..c121b502a462 100644
--- a/drivers/net/wireless/mediatek/mt76/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/debugfs.c
@@ -33,7 +33,8 @@  mt76_reg_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set,
+			 "0x%08llx\n");
 
 static int
 mt76_queues_read(struct seq_file *s, void *data)
@@ -65,8 +66,8 @@  struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
 
 	debugfs_create_u8("led_pin", S_IRUSR | S_IWUSR, dir, &dev->led_pin);
 	debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg);
-	debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev,
-			    &fops_regval);
+	debugfs_create_file_unsafe("regval", S_IRUSR | S_IWUSR, dir, dev,
+				   &fops_regval);
 	debugfs_create_blob("eeprom", S_IRUSR, dir, &dev->eeprom);
 	if (dev->otp.data)
 		debugfs_create_blob("otp", S_IRUSR, dir, &dev->otp);