Skip to content

Commit e250fab

Browse files
YueHaibingholtmann
authored andcommitted
Bluetooth: 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: YueHaibing <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 5c0a100 commit e250fab

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

net/bluetooth/6lowpan.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,8 @@ static int lowpan_enable_get(void *data, u64 *val)
11081108
return 0;
11091109
}
11101110

1111-
DEFINE_SIMPLE_ATTRIBUTE(lowpan_enable_fops, lowpan_enable_get,
1112-
lowpan_enable_set, "%llu\n");
1111+
DEFINE_DEBUGFS_ATTRIBUTE(lowpan_enable_fops, lowpan_enable_get,
1112+
lowpan_enable_set, "%llu\n");
11131113

11141114
static ssize_t lowpan_control_write(struct file *fp,
11151115
const char __user *user_buffer,
@@ -1278,9 +1278,10 @@ static struct notifier_block bt_6lowpan_dev_notifier = {
12781278

12791279
static int __init bt_6lowpan_init(void)
12801280
{
1281-
lowpan_enable_debugfs = debugfs_create_file("6lowpan_enable", 0644,
1282-
bt_debugfs, NULL,
1283-
&lowpan_enable_fops);
1281+
lowpan_enable_debugfs = debugfs_create_file_unsafe("6lowpan_enable",
1282+
0644, bt_debugfs,
1283+
NULL,
1284+
&lowpan_enable_fops);
12841285
lowpan_control_debugfs = debugfs_create_file("6lowpan_control", 0644,
12851286
bt_debugfs, NULL,
12861287
&lowpan_control_fops);

0 commit comments

Comments
 (0)