Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3656065imm; Fri, 20 Jul 2018 23:49:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcX5T6Gzql6W+hYmgZ1NbBediF1cNw+KyEbW5ZwJHjj99c8dGKutFF0m8rxgnvi9lHQO+bn X-Received: by 2002:a65:6110:: with SMTP id z16-v6mr4791995pgu.412.1532155750735; Fri, 20 Jul 2018 23:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532155750; cv=none; d=google.com; s=arc-20160816; b=VrUvwqyxpAzV0QqJ9Pm/5rpW1EmCO0kuBvCJjbnDSyeUeWriZZq1p8Bf6O6hPtmj8t 9Cim6hikHCdZE+IBPMU5mnl9B6mTG4qq54Sc2RollSpgX6UJlf5pqbnxU+Sn7EoMoqcG p0//+oBV2/LElEo3IdH4QmL1QZHw4QweV/uuMimygXUXgVnhyZPsle6vWvEXMPU7nMmy KPQVJcb4jyHBNX/2MyhoNmnvixLQXqtMSNsY1PfTabgEXXG2I33aw4PKuzqy189FVz59 g0bCtnQG/xYumBwaZc80g0yLgmbzaX77w2FDyLgDpInI+aen44uEeZQMTD5HLcWsToSW Q96w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date:arc-authentication-results; bh=PDI0QvFNPJjQEdr7FjdkGaksgNDVSalICAlRsqQ9i/M=; b=ThRY54FAIZEFGOcyz+oX4aIr8EiuYLeuNAb3dvBJySOl8aGLkXlxGP1gnGeaEB6p2G 9e0x70julrr+/VrGKiFXunmy20h0WEOyxXkUWk24za/Z3Ve3GiVQtxVrPZaO+pSYVh+F vQ4pr+hCuh31H09kyWE5qEkheGrLnpGZNxg/frOafmQNGbtEGw8SzI5xq+QzFavm2Puy bLJVfQ7EdY1JVM/Lm83RzTcQRSd+K1HtGlipl3vkx8zor2OFpXl80NJyZdMXo96Gp1H8 dDK1tYo2gUo94AYbgB5odQ+FsQM3ay8i28vag1DltTFwj/o2f3SUc6+5Y7BGEqbCsF5r iqMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8-v6si3135936pgq.432.2018.07.20.23.48.56; Fri, 20 Jul 2018 23:49:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727483AbeGUHjD (ORCPT + 99 others); Sat, 21 Jul 2018 03:39:03 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:32994 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbeGUHjD (ORCPT ); Sat, 21 Jul 2018 03:39:03 -0400 X-IronPort-AV: E=Sophos;i="5.51,383,1526335200"; d="scan'208";a="273663712" Received: from abo-214-111-68.mrs.modulonet.fr (HELO [192.168.0.15]) ([85.68.111.214]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jul 2018 08:47:24 +0200 Date: Sat, 21 Jul 2018 08:47:24 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Logan Gunthorpe cc: Jon Mason , Dave Jiang , Allen Hubbe , linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, kbuild-all@01.org Subject: [PATCH] NTB: fix debugfs_simple_attr.cocci warnings Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } }