public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mt76: fix debugfs_simple_attr.cocci warnings
@ 2017-02-02 14:06 Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-02-02 14:06 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, kvalo, kbuild-all

Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.

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

CC: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

I'm just passing this along.  I don't personally know anything about this
issue.

 debugfs.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- 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)
@@ -64,8 +65,8 @@ struct dentry *mt76_register_debugfs(str
 		return NULL;

 	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);

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

* [PATCH] mt76: fix debugfs_simple_attr.cocci warnings
  2017-11-20 19:35 [PATCH v7 3/3] mt76: add driver code for MT76x2e Felix Fietkau
@ 2017-11-23  7:27 ` kbuild test robot
  2017-12-07 13:42   ` Kalle Valo
  0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2017-11-23  7:27 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: kbuild-all, linux-wireless, kvalo

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>
---

Please take the patch only if it's a positive warning. Thanks!

 debugfs.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- 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(str
 
 	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);

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

* Re: [PATCH] mt76: fix debugfs_simple_attr.cocci warnings
  2017-11-23  7:27 ` [PATCH] mt76: fix debugfs_simple_attr.cocci warnings kbuild test robot
@ 2017-12-07 13:42   ` Kalle Valo
  2017-12-08  1:29     ` Fengguang Wu
  0 siblings, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2017-12-07 13:42 UTC (permalink / raw)
  To: kbuild test robot; +Cc: Felix Fietkau, kbuild-all, linux-wireless

kbuild test robot <lkp@intel.com> writes:

> 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>

I would like to apply this but the From field doesn't match the s-o-b
line. This patch is created automatically, right? I think the best is
that if you modify your script to add this to the beginning of the
commit log:

From: Fengguang Wu <fengguang.wu@intel.com>

That way From and s-o-b match and you can continue to submit it from the
lkp address.

-- 
Kalle Valo

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

* Re: [PATCH] mt76: fix debugfs_simple_attr.cocci warnings
  2017-12-07 13:42   ` Kalle Valo
@ 2017-12-08  1:29     ` Fengguang Wu
  0 siblings, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2017-12-08  1:29 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Felix Fietkau, kbuild-all, linux-wireless

Hi Kalle,

On Thu, Dec 07, 2017 at 03:42:39PM +0200, Kalle Valo wrote:
>kbuild test robot <lkp@intel.com> writes:
>
>> 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>
>
>I would like to apply this but the From field doesn't match the s-o-b
>line. This patch is created automatically, right? I think the best is
>that if you modify your script to add this to the beginning of the
>commit log:
>
>From: Fengguang Wu <fengguang.wu@intel.com>
>
>That way From and s-o-b match and you can continue to submit it from the
>lkp address.

Good idea! I'll follow up with the change.

Thanks,
Fengguang

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

end of thread, other threads:[~2017-12-08  1:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-02 14:06 [PATCH] mt76: fix debugfs_simple_attr.cocci warnings Julia Lawall
  -- strict thread matches above, loose matches on Subject: below --
2017-11-20 19:35 [PATCH v7 3/3] mt76: add driver code for MT76x2e Felix Fietkau
2017-11-23  7:27 ` [PATCH] mt76: fix debugfs_simple_attr.cocci warnings kbuild test robot
2017-12-07 13:42   ` Kalle Valo
2017-12-08  1:29     ` Fengguang Wu

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