mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>,
	Allen Hubbe <allenbh@gmail.com>,
	linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org,
	kbuild-all@01.org
Subject: [PATCH] NTB: fix debugfs_simple_attr.cocci warnings
Date: Sat, 21 Jul 2018 08:47:24 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1807210845090.2381@hadrien> (raw)

From: kbuild test robot <fengguang.wu@intel.com>

 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 <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

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);
 	}
 }


             reply	other threads:[~2018-07-21  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-21  6:47 Julia Lawall [this message]
2018-07-23 17:57 ` Logan Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1807210845090.2381@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=allenbh@gmail.com \
    --cc=dave.jiang@intel.com \
    --cc=jdmason@kudzu.us \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ntb@googlegroups.com \
    --cc=logang@deltatee.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®