From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr. [192.134.164.104]) by gmr-mx.google.com with ESMTPS id v124-v6si72320wma.2.2018.07.20.23.47.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 23:47:25 -0700 (PDT) Date: Sat, 21 Jul 2018 08:47:24 +0200 (CEST) From: Julia Lawall Subject: [PATCH] NTB: fix debugfs_simple_attr.cocci warnings Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII To: Logan Gunthorpe Cc: Jon Mason , Dave Jiang , Allen Hubbe , linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, kbuild-all@01.org List-ID: 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 * &peer->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(&peer->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, - &ntb_msit_local_port_fops); + debugfs_create_file_unsafe("port", 0400, nm->dbgfs_dir, nm, + &ntb_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, - &nm->peers[i], &ntb_msit_trigger_fops); - - debugfs_create_file("port", 0400, peer_dir, - &nm->peers[i], &ntb_msit_port_fops); - - debugfs_create_file("count", 0400, peer_dir, - &nm->peers[i], &ntb_msit_count_fops); - - debugfs_create_file("ready", 0600, peer_dir, - &nm->peers[i], &ntb_msit_ready_fops); + debugfs_create_file_unsafe("trigger", 0200, peer_dir, + &nm->peers[i], + &ntb_msit_trigger_fops); + + debugfs_create_file_unsafe("port", 0400, peer_dir, + &nm->peers[i], &ntb_msit_port_fops); + + debugfs_create_file_unsafe("count", 0400, peer_dir, + &nm->peers[i], + &ntb_msit_count_fops); + + debugfs_create_file_unsafe("ready", 0600, peer_dir, + &nm->peers[i], + &ntb_msit_ready_fops); } for (i = 0; i < num_irqs; i++) { snprintf(buf, sizeof(buf), "irq%d_occurrences", i); - debugfs_create_file(buf, 0400, nm->dbgfs_dir, - &nm->isr_ctx[i], - &ntb_msit_occurrences_fops); + debugfs_create_file_unsafe(buf, 0400, nm->dbgfs_dir, + &nm->isr_ctx[i], + &ntb_msit_occurrences_fops); } }