From patchwork Thu Mar 29 19:12:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10316085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0D24602D6 for ; Thu, 29 Mar 2018 19:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B602D2A236 for ; Thu, 29 Mar 2018 19:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A928E2A2E8; Thu, 29 Mar 2018 19:12:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFD0E2A236 for ; Thu, 29 Mar 2018 19:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbeC2TMZ (ORCPT ); Thu, 29 Mar 2018 15:12:25 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:42993 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750866AbeC2TMZ (ORCPT ); Thu, 29 Mar 2018 15:12:25 -0400 X-IronPort-AV: E=Sophos;i="5.48,378,1517871600"; d="scan'208";a="320614081" Received: from ip-146.net-89-2-7.rev.numericable.fr (HELO [192.168.0.15]) ([89.2.7.146]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2018 21:12:07 +0200 Date: Thu, 29 Mar 2018 21:12:06 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Francisco Jerez cc: kbuild-all@01.org, Srinivas Pandruvada , Len Brown , "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, 0day robot Subject: [PATCH] OPTIONAL: cpufreq/intel_pstate: fix debugfs_simple_attr.cocci warnings Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Fixes: 9eec7989e762 ("OPTIONAL: cpufreq/intel_pstate: Expose LP controller parameters via debugfs.") CC: Francisco Jerez Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- I don't actually know anything about this issue. The change was suggested by kbuild. intel_pstate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -885,7 +885,7 @@ static int lp_param_get(void *data, u64 *val = *(u32 *)data; return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_lp_param, lp_param_get, lp_param_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_lp_param, lp_param_get, lp_param_set, "%llu\n"); static struct dentry *debugfs_parent; @@ -922,9 +922,10 @@ static void intel_pstate_debug_expose_pa for (i = 0; lp_files[i].name; i++) { struct dentry *dentry; - dentry = debugfs_create_file(lp_files[i].name, 0660, - debugfs_parent, lp_files[i].value, - &fops_lp_param); + dentry = debugfs_create_file_unsafe(lp_files[i].name, 0660, + debugfs_parent, + lp_files[i].value, + &fops_lp_param); if (!IS_ERR(dentry)) lp_files[i].dentry = dentry; }