Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2460871imu; Thu, 29 Nov 2018 05:29:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/U2Jp4DSw1/N+4LcPPVNAWSXcsppHlKw7LqYYko4tS/YhedvqEwaiG4qfxVbBpEJ17+Nqjv X-Received: by 2002:a63:2586:: with SMTP id l128mr1283856pgl.104.1543498182707; Thu, 29 Nov 2018 05:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543498182; cv=none; d=google.com; s=arc-20160816; b=tEduuWmy2FHsfGZx3LMDVAt/Mdu1RCAHBpdOahA/1fjL4u/kxvDQBbrLAp+ryMAoos ampFWG4rlRs8XBV7Ir0tkwSz+N0W5Kck4ijcDbg8nKVxE6FYgUezlSSydYyzBaxVoXX8 aMQaRCNYElzcWPc4pZ7b9nUl//Ki+sixIa2pE5n9VgehBHTT3HOBEM0BlAnzlFA2nhEF f+Tk5K9YahjWvjxemKgH3feLO5iIf1GcxGMVm+bmQaBn1o1B8r6Jdim/PmPsrq0Hbzci NkearQQXjTViKhgvcxmqfxDXAXYLAUR93mSRD88avllZaIg9LuzLd9Tm81D53xAyvg8w 1Ujw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from; bh=m4Wn5kfhBLpbnhvTtmHYFdLDO9Hewb3MD55RAYawbd4=; b=bHN06sqVx4KfjjryPh21KFN+AibBlOSaBXVHU+tHAHCLjRm9gWgS7ddyQY3k1JkQdf DM/fVdS0qknD47VZ8eTGvIzob/KPCQvsWrlBDncbD7fEv1gZTG2VbH/A8RKVKo8mN0FE zxbH6TlC7G3n8JRbYQ1/c1nyuaYNMcXA1HEPV17XebArUGAELn3gXOksT0RERvjjumo8 9rx8GhmbGcxImu+F+l7Ar/l8crmZqD7FHuwab5poEFK9IdqYM0jZ8ZZNCJkkQExZ8z2D zgJBx1aMvNieVP6Yx2MUCg1r874WlPDSj9++3VdwAEB4MVTgn6V5WlxF6+JfEUlkfOwL hP4g== 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 91-v6si2196493ply.335.2018.11.29.05.29.27; Thu, 29 Nov 2018 05:29:42 -0800 (PST) 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 S1728355AbeK3AcP (ORCPT + 99 others); Thu, 29 Nov 2018 19:32:15 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:45813 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726724AbeK3AcP (ORCPT ); Thu, 29 Nov 2018 19:32:15 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A1E86A779E4F0; Thu, 29 Nov 2018 21:26:49 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.408.0; Thu, 29 Nov 2018 21:26:41 +0800 From: YueHaibing To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Michal Suchanek , Diana Craciun , "Mauricio Faria de Oliveira" , Nicholas Piggin CC: YueHaibing , , , Subject: [PATCH -next] powerpc/64s: Fix debugfs_simple_attr.cocci warnings Date: Thu, 29 Nov 2018 13:35:18 +0000 Message-ID: <1543498518-107601-1-git-send-email-yuehaibing@huawei.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: YueHaibing --- arch/powerpc/kernel/security.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c index 9703dce..14bb806 100644 --- a/arch/powerpc/kernel/security.c +++ b/arch/powerpc/kernel/security.c @@ -90,13 +90,14 @@ static int barrier_nospec_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_barrier_nospec, - barrier_nospec_get, barrier_nospec_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_barrier_nospec, barrier_nospec_get, + barrier_nospec_set, "%llu\n"); static __init int barrier_nospec_debugfs_init(void) { - debugfs_create_file("barrier_nospec", 0600, powerpc_debugfs_root, NULL, - &fops_barrier_nospec); + debugfs_create_file_unsafe("barrier_nospec", 0600, + powerpc_debugfs_root, NULL, + &fops_barrier_nospec); return 0; } device_initcall(barrier_nospec_debugfs_init); @@ -339,11 +340,13 @@ static int stf_barrier_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_stf_barrier, stf_barrier_get, stf_barrier_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_stf_barrier, stf_barrier_get, stf_barrier_set, + "%llu\n"); static __init int stf_barrier_debugfs_init(void) { - debugfs_create_file("stf_barrier", 0600, powerpc_debugfs_root, NULL, &fops_stf_barrier); + debugfs_create_file_unsafe("stf_barrier", 0600, powerpc_debugfs_root, + NULL, &fops_stf_barrier); return 0; } device_initcall(stf_barrier_debugfs_init); @@ -404,13 +407,14 @@ static int count_cache_flush_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_count_cache_flush, count_cache_flush_get, - count_cache_flush_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_count_cache_flush, count_cache_flush_get, + count_cache_flush_set, "%llu\n"); static __init int count_cache_flush_debugfs_init(void) { - debugfs_create_file("count_cache_flush", 0600, powerpc_debugfs_root, - NULL, &fops_count_cache_flush); + debugfs_create_file_unsafe("count_cache_flush", 0600, + powerpc_debugfs_root, NULL, + &fops_count_cache_flush); return 0; } device_initcall(count_cache_flush_debugfs_init);