Message ID | 20221101081611.8179-1-liubo03@inspur.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2816352wru; Tue, 1 Nov 2022 01:24:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yYnBe2Zr2rKcVpq115boZBP6fJ5vtft5EshohdoLRcjojkJKb1iDIh2ONl9ckulqyU4VD X-Received: by 2002:a05:6402:190f:b0:461:bd53:27c4 with SMTP id e15-20020a056402190f00b00461bd5327c4mr17597756edz.75.1667291064650; Tue, 01 Nov 2022 01:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667291064; cv=none; d=google.com; s=arc-20160816; b=rmL8MWBePXkIiaT2noLaFkPJAFmH597Bt2rerSGuNmylzUCput/skArgOeB4cQhBDC izEKYq6kJ0UVCxZRiT3mim+CHs70zGQ+gB6vAEvQYbXiUce06eN0FNqQlScvl+XQho/1 ns4k4B9B907W2q2G61zNBDRA+4U5UMLtiYUTaUX9k2GGvr9oH4XCS+br7v3Y/9CvC+Wp 2KmKHw5S5PBr0Fy/HGSjWjMMnxxqr7Y+4LdEFDkIVDyyYiZ0OgSac/r/J+WdIAGMny3L y7qyhiZDckqHEZCjX/YVmxNZk8U/lnN9mfdaLOLgFI4pPcCEXIJvA8XgIi4YXanBp4VZ ojRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:mime-version:message-id :date:subject:cc:to:from; bh=JETO8PsscMMf4ULN+rDDNv0uoo5nO79NTD2ZUhkHO8k=; b=UcEqTiNcTUFwS0ppq5hdxlvyI4Co4qet0YcNRumHNMhpcid+BShUzOuTqzU+qt17t4 NlIyd73wHlF+eSaoO8gN4RgGRVOYo3HvjwmWZVjeSr297n/ytbRCKzx1nG8IS8O3v/Cd /9jPp/x76qKbT6v95WXU2ReVSOsMlI/5Amo4vQQHXbtjgX5oLAZEz1RphxkunGf0sGGg okHdVvrepgwpG22zUaOPQbwEh8ThOhlvgKTTFgoL6ssdm1mkF88is4iAMlzUS+k2aLd/ wbyAczwWdHGqAaT22mPOjWsbYTJs9D6ITGxdK8znULZBdQB1k2XmneQXDnPgCiGcQ4GL +wUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a508d07000000b00463a83ce065si1817940eds.420.2022.11.01.01.24.01; Tue, 01 Nov 2022 01:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiKAIQU (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Tue, 1 Nov 2022 04:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiKAIQS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 1 Nov 2022 04:16:18 -0400 Received: from ssh248.corpemail.net (ssh248.corpemail.net [210.51.61.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1527EE0D; Tue, 1 Nov 2022 01:16:15 -0700 (PDT) Received: from ([60.208.111.195]) by ssh248.corpemail.net ((D)) with ASMTP (SSL) id WLS00012; Tue, 01 Nov 2022 16:16:12 +0800 Received: from localhost.localdomain (10.200.104.97) by jtjnmail201603.home.langchao.com (10.100.2.3) with Microsoft SMTP Server id 15.1.2507.12; Tue, 1 Nov 2022 16:16:13 +0800 From: Bo Liu <liubo03@inspur.com> To: <krzysztof.kozlowski@linaro.org>, <thierry.reding@gmail.com>, <jonathanh@nvidia.com> CC: <linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>, Bo Liu <liubo03@inspur.com> Subject: [PATCH] memory: tegra20-emc: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE Date: Tue, 1 Nov 2022 04:16:11 -0400 Message-ID: <20221101081611.8179-1-liubo03@inspur.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.200.104.97] tUid: 20221101161612805c7c5ea3d01c1012e969ff4e38ba2d X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748281395116910079?= X-GMAIL-MSGID: =?utf-8?q?1748281395116910079?= |
Series |
memory: tegra20-emc: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
|
|
Commit Message
Bo Liu
Nov. 1, 2022, 8:16 a.m. UTC
Fix the following coccicheck warning:
drivers/memory/tegra/tegra20-emc.c:902:0-23: WARNING:
tegra_emc_debug_max_rate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
drivers/memory/tegra/tegra20-emc.c:872:0-23: WARNING:
tegra_emc_debug_min_rate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
Signed-off-by: Bo Liu <liubo03@inspur.com>
---
drivers/memory/tegra/tegra20-emc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Tue, Nov 01, 2022 at 04:16:11AM -0400, Bo Liu wrote: > Fix the following coccicheck warning: > drivers/memory/tegra/tegra20-emc.c:902:0-23: WARNING: > tegra_emc_debug_max_rate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE > drivers/memory/tegra/tegra20-emc.c:872:0-23: WARNING: > tegra_emc_debug_min_rate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > Signed-off-by: Bo Liu <liubo03@inspur.com> > --- > drivers/memory/tegra/tegra20-emc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) This seems incomplete: the rationale in that debugfs cocci script says that DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe() is the pattern to use vs. the less efficient DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file(). So this patch should probably use the unsafe function variant at the same time to take full advantage. Thierry > > diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c > index bd4e37b6552d..c2b4caccfae9 100644 > --- a/drivers/memory/tegra/tegra20-emc.c > +++ b/drivers/memory/tegra/tegra20-emc.c > @@ -869,7 +869,7 @@ static int tegra_emc_debug_min_rate_set(void *data, u64 rate) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_min_rate_fops, > +DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_min_rate_fops, > tegra_emc_debug_min_rate_get, > tegra_emc_debug_min_rate_set, "%llu\n"); > > @@ -899,7 +899,7 @@ static int tegra_emc_debug_max_rate_set(void *data, u64 rate) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_max_rate_fops, > +DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_max_rate_fops, > tegra_emc_debug_max_rate_get, > tegra_emc_debug_max_rate_set, "%llu\n"); > > -- > 2.27.0 >
On Tue, Nov 01, 2022 at 12:52:14PM +0100, Thierry Reding wrote: > On Tue, Nov 01, 2022 at 04:16:11AM -0400, Bo Liu wrote: > > Fix the following coccicheck warning: > > drivers/memory/tegra/tegra20-emc.c:902:0-23: WARNING: > > tegra_emc_debug_max_rate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > drivers/memory/tegra/tegra20-emc.c:872:0-23: WARNING: > > tegra_emc_debug_min_rate_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > > > Signed-off-by: Bo Liu <liubo03@inspur.com> > > --- > > drivers/memory/tegra/tegra20-emc.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > This seems incomplete: the rationale in that debugfs cocci script says > that DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe() is the > pattern to use vs. the less efficient DEFINE_SIMPLE_ATTRIBUTE + > debugfs_create_file(). So this patch should probably use the unsafe > function variant at the same time to take full advantage. That said, I'm not even sure if these attributes would qualify for debugfs_create_file_unsafe() since there's really no protection against removal. Overall that cocci seems a bit misleading in that it makes these changes seem like trivial conversions. Only converting DEFINE_SIMPLE_ATTRIBUTE() to DEFINE_DEBUGFS_ATTRIBUTE() is basically a noop, except that debugfs has a little more overhead (for example debugfs_attr_read() wraps simple_attr_read()), so I'm not sure if that's worth doing on its own. Thierry > > > > diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c > > index bd4e37b6552d..c2b4caccfae9 100644 > > --- a/drivers/memory/tegra/tegra20-emc.c > > +++ b/drivers/memory/tegra/tegra20-emc.c > > @@ -869,7 +869,7 @@ static int tegra_emc_debug_min_rate_set(void *data, u64 rate) > > return 0; > > } > > > > -DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_min_rate_fops, > > +DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_min_rate_fops, > > tegra_emc_debug_min_rate_get, > > tegra_emc_debug_min_rate_set, "%llu\n"); > > > > @@ -899,7 +899,7 @@ static int tegra_emc_debug_max_rate_set(void *data, u64 rate) > > return 0; > > } > > > > -DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_max_rate_fops, > > +DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_max_rate_fops, > > tegra_emc_debug_max_rate_get, > > tegra_emc_debug_max_rate_set, "%llu\n"); > > > > -- > > 2.27.0 > >
diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c index bd4e37b6552d..c2b4caccfae9 100644 --- a/drivers/memory/tegra/tegra20-emc.c +++ b/drivers/memory/tegra/tegra20-emc.c @@ -869,7 +869,7 @@ static int tegra_emc_debug_min_rate_set(void *data, u64 rate) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_min_rate_fops, +DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_min_rate_fops, tegra_emc_debug_min_rate_get, tegra_emc_debug_min_rate_set, "%llu\n"); @@ -899,7 +899,7 @@ static int tegra_emc_debug_max_rate_set(void *data, u64 rate) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(tegra_emc_debug_max_rate_fops, +DEFINE_DEBUGFS_ATTRIBUTE(tegra_emc_debug_max_rate_fops, tegra_emc_debug_max_rate_get, tegra_emc_debug_max_rate_set, "%llu\n");