From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 588DAC00449 for ; Mon, 8 Oct 2018 08:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3EE52087D for ; Mon, 8 Oct 2018 08:27:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3EE52087D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726982AbeJHPhy (ORCPT ); Mon, 8 Oct 2018 11:37:54 -0400 Received: from ozlabs.org ([203.11.71.1]:53325 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbeJHPhy (ORCPT ); Mon, 8 Oct 2018 11:37:54 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 42TD4Q4FsSz9s9J; Mon, 8 Oct 2018 19:27:18 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: YueHaibing , Benjamin Herrenschmidt , Paul Mackerras , David Hildenbrand , Michael Neuling , Balbir Singh , Rashmica Gupta , Andrew Morton , Pavel Tatashin , Stephen Rothwell Cc: YueHaibing , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings In-Reply-To: <1538736631-99728-1-git-send-email-yuehaibing@huawei.com> References: <1538736631-99728-1-git-send-email-yuehaibing@huawei.com> Date: Mon, 08 Oct 2018 19:27:17 +1100 Message-ID: <87va6c268q.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org YueHaibing writes: > 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(). Sorry this isn't detailed enough for me to actually understand the pros/cons of this patch. Perhaps I'm expected to know it, but I don't. I had a look at what each macro produces and it wasn't obvious to me what the benefit is. cheers > Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci > > Signed-off-by: YueHaibing > --- > arch/powerpc/platforms/powernv/memtrace.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c > index 84d038e..0cb6548 100644 > --- a/arch/powerpc/platforms/powernv/memtrace.c > +++ b/arch/powerpc/platforms/powernv/memtrace.c > @@ -311,8 +311,8 @@ static int memtrace_enable_get(void *data, u64 *val) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get, > - memtrace_enable_set, "0x%016llx\n"); > +DEFINE_DEBUGFS_ATTRIBUTE(memtrace_init_fops, memtrace_enable_get, > + memtrace_enable_set, "0x%016llx\n"); > > static int memtrace_init(void) > { > @@ -321,8 +321,8 @@ static int memtrace_init(void) > if (!memtrace_debugfs_dir) > return -1; > > - debugfs_create_file("enable", 0600, memtrace_debugfs_dir, > - NULL, &memtrace_init_fops); > + debugfs_create_file_unsafe("enable", 0600, memtrace_debugfs_dir, NULL, > + &memtrace_init_fops); > > return 0; > }