From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757711AbcHCL5q (ORCPT ); Wed, 3 Aug 2016 07:57:46 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:49763 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753254AbcHCL5n (ORCPT ); Wed, 3 Aug 2016 07:57:43 -0400 X-IronPort-AV: E=Sophos;i="5.28,465,1464645600"; d="scan'208";a="228877374" Date: Wed, 3 Aug 2016 13:57:37 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Andi Kleen cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] fix debugfs_simple_attr.cocci warnings (fwd) Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I know nothing about the issues behind this, but I'm forwarding it in case it's useful. julia ---------- Forwarded message ---------- Date: Wed, 3 Aug 2016 13:26:56 +0800 From: kbuild test robot To: kbuild@01.org Cc: Julia Lawall Subject: [PATCH] fix debugfs_simple_attr.cocci warnings CC: kbuild-all@01.org In-Reply-To: <1470170405-21530-1-git-send-email-andi@firstfloor.org> TO: Andi Kleen CC: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Andi Kleen CC: linux-kernel@vger.kernel.org, Andi Kleen kernel/panic.c:561:0-23: WARNING: clear_warn_once_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE 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 CC: Andi Kleen Signed-off-by: Fengguang Wu --- Please take the patch only if it's a positive warning. Thanks! panic.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/kernel/panic.c +++ b/kernel/panic.c @@ -558,16 +558,14 @@ static int clear_warn_once_set(void *dat return 0; } -DEFINE_SIMPLE_ATTRIBUTE(clear_warn_once_fops, - NULL, - clear_warn_once_set, - "%lld\n"); +DEFINE_DEBUGFS_ATTRIBUTE(clear_warn_once_fops, NULL, clear_warn_once_set, + "%lld\n"); static __init int register_warn_debugfs(void) { /* Don't care about failure */ - debugfs_create_file("clear_warn_once", 0644, NULL, - NULL, &clear_warn_once_fops); + debugfs_create_file_unsafe("clear_warn_once", 0644, NULL, NULL, + &clear_warn_once_fops); return 0; }