Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings
@ 2018-12-20  2:53 YueHaibing
  2018-12-24 16:12 ` Alexander Aring
  2019-01-18  9:10 ` Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: YueHaibing @ 2018-12-20  2:53 UTC (permalink / raw)
  To: Alexander Aring, Jukka Rissanen
  Cc: YueHaibing, linux-bluetooth, linux-wpan, kernel-janitors

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

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/6lowpan/debugfs.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
index 6c152f9..536aae5 100644
--- a/net/6lowpan/debugfs.c
+++ b/net/6lowpan/debugfs.c
@@ -41,9 +41,9 @@ static int lowpan_ctx_flag_active_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(lowpan_ctx_flag_active_fops,
-			lowpan_ctx_flag_active_get,
-			lowpan_ctx_flag_active_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(lowpan_ctx_flag_active_fops,
+			 lowpan_ctx_flag_active_get,
+			 lowpan_ctx_flag_active_set, "%llu\n");
 
 static int lowpan_ctx_flag_c_set(void *data, u64 val)
 {
@@ -66,8 +66,8 @@ static int lowpan_ctx_flag_c_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(lowpan_ctx_flag_c_fops, lowpan_ctx_flag_c_get,
-			lowpan_ctx_flag_c_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(lowpan_ctx_flag_c_fops, lowpan_ctx_flag_c_get,
+			 lowpan_ctx_flag_c_set, "%llu\n");
 
 static int lowpan_ctx_plen_set(void *data, u64 val)
 {
@@ -97,8 +97,8 @@ static int lowpan_ctx_plen_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(lowpan_ctx_plen_fops, lowpan_ctx_plen_get,
-			lowpan_ctx_plen_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(lowpan_ctx_plen_fops, lowpan_ctx_plen_get,
+			 lowpan_ctx_plen_set, "%llu\n");
 
 static int lowpan_ctx_pfx_show(struct seq_file *file, void *offset)
 {
@@ -184,15 +184,15 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
 	if (!root)
 		return -EINVAL;
 
-	dentry = debugfs_create_file("active", 0644, root,
-				     &ldev->ctx.table[id],
-				     &lowpan_ctx_flag_active_fops);
+	dentry = debugfs_create_file_unsafe("active", 0644, root,
+					    &ldev->ctx.table[id],
+					    &lowpan_ctx_flag_active_fops);
 	if (!dentry)
 		return -EINVAL;
 
-	dentry = debugfs_create_file("compression", 0644, root,
-				     &ldev->ctx.table[id],
-				     &lowpan_ctx_flag_c_fops);
+	dentry = debugfs_create_file_unsafe("compression", 0644, root,
+					    &ldev->ctx.table[id],
+					    &lowpan_ctx_flag_c_fops);
 	if (!dentry)
 		return -EINVAL;
 
@@ -202,9 +202,9 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
 	if (!dentry)
 		return -EINVAL;
 
-	dentry = debugfs_create_file("prefix_len", 0644, root,
-				     &ldev->ctx.table[id],
-				     &lowpan_ctx_plen_fops);
+	dentry = debugfs_create_file_unsafe("prefix_len", 0644, root,
+					    &ldev->ctx.table[id],
+					    &lowpan_ctx_plen_fops);
 	if (!dentry)
 		return -EINVAL;
 
@@ -245,8 +245,8 @@ static int lowpan_short_addr_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(lowpan_short_addr_fops, lowpan_short_addr_get,
-			NULL, "0x%04llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(lowpan_short_addr_fops, lowpan_short_addr_get, NULL,
+			 "0x%04llx\n");
 
 static int lowpan_dev_debugfs_802154_init(const struct net_device *dev,
 					  struct lowpan_dev *ldev)
@@ -260,9 +260,9 @@ static int lowpan_dev_debugfs_802154_init(const struct net_device *dev,
 	if (!root)
 		return -EINVAL;
 
-	dentry = debugfs_create_file("short_addr", 0444, root,
-				     lowpan_802154_dev(dev)->wdev->ieee802154_ptr,
-				     &lowpan_short_addr_fops);
+	dentry = debugfs_create_file_unsafe("short_addr", 0444, root,
+					    lowpan_802154_dev(dev)->wdev->ieee802154_ptr,
+					    &lowpan_short_addr_fops);
 	if (!dentry)
 		return -EINVAL;
 

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

* Re: [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings
  2018-12-20  2:53 [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings YueHaibing
@ 2018-12-24 16:12 ` Alexander Aring
  2019-01-14 18:52   ` Stefan Schmidt
  2019-01-18  9:10 ` Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Aring @ 2018-12-24 16:12 UTC (permalink / raw)
  To: YueHaibing
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth, linux-wpan,
	kernel-janitors

Hi,

On Thu, Dec 20, 2018 at 02:53:53AM +0000, YueHaibing wrote:
> 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().
> 

Ok.

> Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Acked-by: Alexander Aring <aring@mojatatu.com>

Reminder to myself: We should finally move this crap away which is even
not net namespace aware and introduce a stable uapi. I would love to see
it that it can be controlled by iproute2. :-)

- Alex

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

* Re: [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings
  2018-12-24 16:12 ` Alexander Aring
@ 2019-01-14 18:52   ` Stefan Schmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Schmidt @ 2019-01-14 18:52 UTC (permalink / raw)
  To: Alexander Aring, YueHaibing
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth, linux-wpan,
	kernel-janitors

Hello.

On 24.12.18 17:12, Alexander Aring wrote:
> Hi,
> 
> On Thu, Dec 20, 2018 at 02:53:53AM +0000, YueHaibing wrote:
>> 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().
>>
> 
> Ok.
> 
>> Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> Acked-by: Alexander Aring <aring@mojatatu.com>

Marcel, Johan, can one of you apply this? My rule is still that 6lowpan
patches are going through the bluetooth tree. If you want me to pick the
sporadic patch here and there for 6lowpan let me know.

regards
Stefan Schmidt

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

* Re: [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings
  2018-12-20  2:53 [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings YueHaibing
  2018-12-24 16:12 ` Alexander Aring
@ 2019-01-18  9:10 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2019-01-18  9:10 UTC (permalink / raw)
  To: YueHaibing
  Cc: Alexander Aring, Jukka Rissanen, linux-bluetooth, linux-wpan,
	kernel-janitors

Hi Yue,

> 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
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> net/6lowpan/debugfs.c | 42 +++++++++++++++++++++---------------------
> 1 file changed, 21 insertions(+), 21 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20  2:53 [PATCH net-next] 6lowpan: fix debugfs_simple_attr.cocci warnings YueHaibing
2018-12-24 16:12 ` Alexander Aring
2019-01-14 18:52   ` Stefan Schmidt
2019-01-18  9:10 ` Marcel Holtmann

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git