Commit 5e053534 authored by YueHaibing's avatar YueHaibing Committed by Marcel Holtmann

6lowpan: fix debugfs_simple_attr.cocci warnings

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: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent e250fab6
...@@ -41,9 +41,9 @@ static int lowpan_ctx_flag_active_get(void *data, u64 *val) ...@@ -41,9 +41,9 @@ static int lowpan_ctx_flag_active_get(void *data, u64 *val)
return 0; return 0;
} }
DEFINE_SIMPLE_ATTRIBUTE(lowpan_ctx_flag_active_fops, DEFINE_DEBUGFS_ATTRIBUTE(lowpan_ctx_flag_active_fops,
lowpan_ctx_flag_active_get, lowpan_ctx_flag_active_get,
lowpan_ctx_flag_active_set, "%llu\n"); lowpan_ctx_flag_active_set, "%llu\n");
static int lowpan_ctx_flag_c_set(void *data, u64 val) 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) ...@@ -66,8 +66,8 @@ static int lowpan_ctx_flag_c_get(void *data, u64 *val)
return 0; return 0;
} }
DEFINE_SIMPLE_ATTRIBUTE(lowpan_ctx_flag_c_fops, lowpan_ctx_flag_c_get, DEFINE_DEBUGFS_ATTRIBUTE(lowpan_ctx_flag_c_fops, lowpan_ctx_flag_c_get,
lowpan_ctx_flag_c_set, "%llu\n"); lowpan_ctx_flag_c_set, "%llu\n");
static int lowpan_ctx_plen_set(void *data, u64 val) static int lowpan_ctx_plen_set(void *data, u64 val)
{ {
...@@ -97,8 +97,8 @@ static int lowpan_ctx_plen_get(void *data, u64 *val) ...@@ -97,8 +97,8 @@ static int lowpan_ctx_plen_get(void *data, u64 *val)
return 0; return 0;
} }
DEFINE_SIMPLE_ATTRIBUTE(lowpan_ctx_plen_fops, lowpan_ctx_plen_get, DEFINE_DEBUGFS_ATTRIBUTE(lowpan_ctx_plen_fops, lowpan_ctx_plen_get,
lowpan_ctx_plen_set, "%llu\n"); lowpan_ctx_plen_set, "%llu\n");
static int lowpan_ctx_pfx_show(struct seq_file *file, void *offset) 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, ...@@ -184,15 +184,15 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
if (!root) if (!root)
return -EINVAL; return -EINVAL;
dentry = debugfs_create_file("active", 0644, root, dentry = debugfs_create_file_unsafe("active", 0644, root,
&ldev->ctx.table[id], &ldev->ctx.table[id],
&lowpan_ctx_flag_active_fops); &lowpan_ctx_flag_active_fops);
if (!dentry) if (!dentry)
return -EINVAL; return -EINVAL;
dentry = debugfs_create_file("compression", 0644, root, dentry = debugfs_create_file_unsafe("compression", 0644, root,
&ldev->ctx.table[id], &ldev->ctx.table[id],
&lowpan_ctx_flag_c_fops); &lowpan_ctx_flag_c_fops);
if (!dentry) if (!dentry)
return -EINVAL; return -EINVAL;
...@@ -202,9 +202,9 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev, ...@@ -202,9 +202,9 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
if (!dentry) if (!dentry)
return -EINVAL; return -EINVAL;
dentry = debugfs_create_file("prefix_len", 0644, root, dentry = debugfs_create_file_unsafe("prefix_len", 0644, root,
&ldev->ctx.table[id], &ldev->ctx.table[id],
&lowpan_ctx_plen_fops); &lowpan_ctx_plen_fops);
if (!dentry) if (!dentry)
return -EINVAL; return -EINVAL;
...@@ -245,8 +245,8 @@ static int lowpan_short_addr_get(void *data, u64 *val) ...@@ -245,8 +245,8 @@ static int lowpan_short_addr_get(void *data, u64 *val)
return 0; return 0;
} }
DEFINE_SIMPLE_ATTRIBUTE(lowpan_short_addr_fops, lowpan_short_addr_get, DEFINE_DEBUGFS_ATTRIBUTE(lowpan_short_addr_fops, lowpan_short_addr_get, NULL,
NULL, "0x%04llx\n"); "0x%04llx\n");
static int lowpan_dev_debugfs_802154_init(const struct net_device *dev, static int lowpan_dev_debugfs_802154_init(const struct net_device *dev,
struct lowpan_dev *ldev) struct lowpan_dev *ldev)
...@@ -260,9 +260,9 @@ static int lowpan_dev_debugfs_802154_init(const struct net_device *dev, ...@@ -260,9 +260,9 @@ static int lowpan_dev_debugfs_802154_init(const struct net_device *dev,
if (!root) if (!root)
return -EINVAL; return -EINVAL;
dentry = debugfs_create_file("short_addr", 0444, root, dentry = debugfs_create_file_unsafe("short_addr", 0444, root,
lowpan_802154_dev(dev)->wdev->ieee802154_ptr, lowpan_802154_dev(dev)->wdev->ieee802154_ptr,
&lowpan_short_addr_fops); &lowpan_short_addr_fops);
if (!dentry) if (!dentry)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment