Re: [PATCH] NTB: fix debugfs_simple_attr.cocci warnings
On 21/07/18 12:47 AM, Julia Lawall wrote: > From: kbuild test robot > > 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 > > Fixes: c75153197d20 ("NTB: Introduce NTB MSI Test Client") > Signed-off-by: kbuild test robot > Signed-off-by: Julia Lawall > --- > > I don't know much about this issue, beyondwhat is explained by the > semantic patch. Please check if the changes can be relevant. Oops, this work wasn't meant for public consumption yet. Everyone pretend you didn't see that ;). I must have pushed it to my repo that kbuild tests by accident. Though, I'm glad to have learned about the more efficient use of debugfs attributes. Logan
Re: [PATCH] NTB: fix debugfs_simple_attr.cocci warnings
On 21/07/18 12:47 AM, Julia Lawall wrote: > From: kbuild test robot > > 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 > > Fixes: c75153197d20 ("NTB: Introduce NTB MSI Test Client") > Signed-off-by: kbuild test robot > Signed-off-by: Julia Lawall > --- > > I don't know much about this issue, beyondwhat is explained by the > semantic patch. Please check if the changes can be relevant. Oops, this work wasn't meant for public consumption yet. Everyone pretend you didn't see that ;). I must have pushed it to my repo that kbuild tests by accident. Though, I'm glad to have learned about the more efficient use of debugfs attributes. Logan
[PATCH] NTB: fix debugfs_simple_attr.cocci warnings
From: kbuild test robot 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 Fixes: c75153197d20 ("NTB: Introduce NTB MSI Test Client") Signed-off-by: kbuild test robot Signed-off-by: Julia Lawall --- I don't know much about this issue, beyondwhat is explained by the semantic patch. Please check if the changes can be relevant. ntb_msi_test.c | 61 - 1 file changed, 31 insertions(+), 30 deletions(-) --- a/drivers/ntb/test/ntb_msi_test.c +++ b/drivers/ntb/test/ntb_msi_test.c @@ -170,8 +170,8 @@ static int ntb_msit_dbgfs_trigger(void * >msi_desc[idx]); } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_trigger_fops, NULL, - ntb_msit_dbgfs_trigger, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_trigger_fops, NULL, ntb_msit_dbgfs_trigger, +"%llu\n"); static int ntb_msit_dbgfs_port_get(void *data, u64 *port) { @@ -182,8 +182,8 @@ static int ntb_msit_dbgfs_port_get(void return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_port_fops, ntb_msit_dbgfs_port_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_port_fops, ntb_msit_dbgfs_port_get, NULL, +"%llu\n"); static int ntb_msit_dbgfs_count_get(void *data, u64 *count) { @@ -194,8 +194,8 @@ static int ntb_msit_dbgfs_count_get(void return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_count_fops, ntb_msit_dbgfs_count_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_count_fops, ntb_msit_dbgfs_count_get, NULL, +"%llu\n"); static int ntb_msit_dbgfs_ready_get(void *data, u64 *ready) { @@ -213,8 +213,8 @@ static int ntb_msit_dbgfs_ready_set(void return wait_for_completion_interruptible(>init_comp); } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_ready_fops, ntb_msit_dbgfs_ready_get, - ntb_msit_dbgfs_ready_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_ready_fops, ntb_msit_dbgfs_ready_get, +ntb_msit_dbgfs_ready_set, "%llu\n"); static int ntb_msit_dbgfs_occurrences_get(void *data, u64 *occurrences) { @@ -225,9 +225,8 @@ static int ntb_msit_dbgfs_occurrences_ge return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_occurrences_fops, - ntb_msit_dbgfs_occurrences_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_occurrences_fops, +ntb_msit_dbgfs_occurrences_get, NULL, "%llu\n"); static int ntb_msit_dbgfs_local_port_get(void *data, u64 *port) { @@ -238,9 +237,8 @@ static int ntb_msit_dbgfs_local_port_get return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_local_port_fops, - ntb_msit_dbgfs_local_port_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_local_port_fops, +ntb_msit_dbgfs_local_port_get, NULL, "%llu\n"); static void ntb_msit_create_dbgfs(struct ntb_msit_ctx *nm) { @@ -251,8 +249,8 @@ static void ntb_msit_create_dbgfs(struct nm->dbgfs_dir = debugfs_create_dir(pci_name(pdev), ntb_msit_dbgfs_topdir); - debugfs_create_file("port", 0400, nm->dbgfs_dir, nm, - _msit_local_port_fops); + debugfs_create_file_unsafe("port", 0400, nm->dbgfs_dir, nm, + _msit_local_port_fops); for (i = 0; i < ntb_peer_port_count(nm->ntb); i++) { nm->peers[i].pidx = i; @@ -262,24 +260,27 @@ static void ntb_msit_create_dbgfs(struct snprintf(buf, sizeof(buf), "peer%d", i); peer_dir = debugfs_create_dir(buf, nm->dbgfs_dir); - debugfs_create_file("trigger", 0200, peer_dir, - >peers[i], _msit_trigger_fops); - - debugfs_create_file("port", 0400, peer_dir, - >peers[i], _msit_port_fops); - - debugfs_create_file("count", 0400, peer_dir, - >peers[i], _msit_count_fops); - - debugfs_create_file("ready", 0600, peer_dir, - >peers[i], _msit_ready_fops); + debugfs_create_file_unsafe("trigger", 0200, peer_dir, + >peers[i], + _msit_trigger_fops); + + debugfs_create_file_unsafe("port", 0400, peer_dir, + >peers[i], _msit_port_fops); + + debugfs_create_file_unsafe("count", 0400, peer_dir, + >peers[i], +
[PATCH] NTB: fix debugfs_simple_attr.cocci warnings
From: kbuild test robot 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 Fixes: c75153197d20 ("NTB: Introduce NTB MSI Test Client") Signed-off-by: kbuild test robot Signed-off-by: Julia Lawall --- I don't know much about this issue, beyondwhat is explained by the semantic patch. Please check if the changes can be relevant. ntb_msi_test.c | 61 - 1 file changed, 31 insertions(+), 30 deletions(-) --- a/drivers/ntb/test/ntb_msi_test.c +++ b/drivers/ntb/test/ntb_msi_test.c @@ -170,8 +170,8 @@ static int ntb_msit_dbgfs_trigger(void * >msi_desc[idx]); } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_trigger_fops, NULL, - ntb_msit_dbgfs_trigger, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_trigger_fops, NULL, ntb_msit_dbgfs_trigger, +"%llu\n"); static int ntb_msit_dbgfs_port_get(void *data, u64 *port) { @@ -182,8 +182,8 @@ static int ntb_msit_dbgfs_port_get(void return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_port_fops, ntb_msit_dbgfs_port_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_port_fops, ntb_msit_dbgfs_port_get, NULL, +"%llu\n"); static int ntb_msit_dbgfs_count_get(void *data, u64 *count) { @@ -194,8 +194,8 @@ static int ntb_msit_dbgfs_count_get(void return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_count_fops, ntb_msit_dbgfs_count_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_count_fops, ntb_msit_dbgfs_count_get, NULL, +"%llu\n"); static int ntb_msit_dbgfs_ready_get(void *data, u64 *ready) { @@ -213,8 +213,8 @@ static int ntb_msit_dbgfs_ready_set(void return wait_for_completion_interruptible(>init_comp); } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_ready_fops, ntb_msit_dbgfs_ready_get, - ntb_msit_dbgfs_ready_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_ready_fops, ntb_msit_dbgfs_ready_get, +ntb_msit_dbgfs_ready_set, "%llu\n"); static int ntb_msit_dbgfs_occurrences_get(void *data, u64 *occurrences) { @@ -225,9 +225,8 @@ static int ntb_msit_dbgfs_occurrences_ge return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_occurrences_fops, - ntb_msit_dbgfs_occurrences_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_occurrences_fops, +ntb_msit_dbgfs_occurrences_get, NULL, "%llu\n"); static int ntb_msit_dbgfs_local_port_get(void *data, u64 *port) { @@ -238,9 +237,8 @@ static int ntb_msit_dbgfs_local_port_get return 0; } -DEFINE_SIMPLE_ATTRIBUTE(ntb_msit_local_port_fops, - ntb_msit_dbgfs_local_port_get, - NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(ntb_msit_local_port_fops, +ntb_msit_dbgfs_local_port_get, NULL, "%llu\n"); static void ntb_msit_create_dbgfs(struct ntb_msit_ctx *nm) { @@ -251,8 +249,8 @@ static void ntb_msit_create_dbgfs(struct nm->dbgfs_dir = debugfs_create_dir(pci_name(pdev), ntb_msit_dbgfs_topdir); - debugfs_create_file("port", 0400, nm->dbgfs_dir, nm, - _msit_local_port_fops); + debugfs_create_file_unsafe("port", 0400, nm->dbgfs_dir, nm, + _msit_local_port_fops); for (i = 0; i < ntb_peer_port_count(nm->ntb); i++) { nm->peers[i].pidx = i; @@ -262,24 +260,27 @@ static void ntb_msit_create_dbgfs(struct snprintf(buf, sizeof(buf), "peer%d", i); peer_dir = debugfs_create_dir(buf, nm->dbgfs_dir); - debugfs_create_file("trigger", 0200, peer_dir, - >peers[i], _msit_trigger_fops); - - debugfs_create_file("port", 0400, peer_dir, - >peers[i], _msit_port_fops); - - debugfs_create_file("count", 0400, peer_dir, - >peers[i], _msit_count_fops); - - debugfs_create_file("ready", 0600, peer_dir, - >peers[i], _msit_ready_fops); + debugfs_create_file_unsafe("trigger", 0200, peer_dir, + >peers[i], + _msit_trigger_fops); + + debugfs_create_file_unsafe("port", 0400, peer_dir, + >peers[i], _msit_port_fops); + + debugfs_create_file_unsafe("count", 0400, peer_dir, + >peers[i], +