[linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
Message ID | 202211231706198927223@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2676147wrr; Wed, 23 Nov 2022 01:07:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf6MuMXvNzS94jvlglq9lY0vsB1+UnxczqYpCiyEt/MdSNPxkG0Vw3krCFOxbr1aYQXG1mnO X-Received: by 2002:a17:906:38a:b0:7a7:1d4f:c7d9 with SMTP id b10-20020a170906038a00b007a71d4fc7d9mr11322195eja.402.1669194478528; Wed, 23 Nov 2022 01:07:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669194478; cv=none; d=google.com; s=arc-20160816; b=SJJBKKx+vXdz2y36GFF3HQBFprMhwMND5fxSyBMH+VijA7c7S0GEQkhQLij8uLmNeY XQNuQ3GPFQWfcIOtFzCpctFTa1/ttIDh9z4v3YHKILS4HJboLbsrfgP7C0lXHEa/d+Q+ jKLWBftfi8T4aibkl70eAblZxkY0f1Y8+3FBN2EJ1flZ6fqHC/AgzWisgEGpzzw31jM8 fnwR3nF0FQslyySWtqGyvMwZPvFFVwAqqMaireKuVl2aUezLi2Nw4+Cj2Lco6TV4Uq1W 8TtJw6s7lursmD4dp/hXb2d+4XmVBiChy4lxiB8OLPl9EmAURkvqcf1e33pgdWTAswbc IM6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=Q1tXxx7QcTWAFWfiwgO0y9PfHLVFd6SJR+0z2sHleZo=; b=OwiuDRK/BfCtbC2eG1iFn5/hY78my1jZazC4oprgv29tFwKSCe8VHn/+Oa2Fwm0HcT to/rqCmf86pGcoY0dfMK0BSpgGmXiFrUgLwF/VfZRQ6hei2/mQPb68wiCPXorZBZTjgr pxjNLpaGk4axHQP8QrkGvx72f5nwuzyFOC1z9hs0sD8ObQbXv/qPNFdUvtRibrOK9Qy+ 8ygony4ew2IEzBy6iYiGjgvbJrW3dGhfJfLloYgLuUMT84bCXa17y/2BtiKzotqjInNj 0oAM+kYGhlK2Zvc5Pe7OxemHG3tJwCKndbB6VJYrkT3Ei8se37SDrHrBNqOZQEmCr1g7 DAgQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb11-20020a170907070b00b007ade20fc415si15430858ejb.811.2022.11.23.01.07.32; Wed, 23 Nov 2022 01:07:58 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237063AbiKWJHZ (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Wed, 23 Nov 2022 04:07:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237155AbiKWJHB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 23 Nov 2022 04:07:01 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A85B1055AB for <linux-kernel@vger.kernel.org>; Wed, 23 Nov 2022 01:06:46 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NHFc36spTz4y0tt; Wed, 23 Nov 2022 17:06:27 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2AN96HLb057157; Wed, 23 Nov 2022 17:06:17 +0800 (+08) (envelope-from zhang.songyi@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid31; Wed, 23 Nov 2022 17:06:19 +0800 (CST) Date: Wed, 23 Nov 2022 17:06:19 +0800 (CST) X-Zmail-TransId: 2afa637de28bffffffffb1842df1 X-Mailer: Zmail v1.0 Message-ID: <202211231706198927223@zte.com.cn> Mime-Version: 1.0 From: <zhang.songyi@zte.com.cn> To: <arnd@arndb.de> Cc: <mpe@ellerman.id.au>, <npiggin@gmail.com>, <christophe.leroy@csgroup.eu>, <linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>, <zhang.songyi@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_linux-next=5D_powerpc/cell/axon=5Fmsi=3A_replace?= =?utf-8?q?_DEFINE=5FSIMPLE=5FATTRIBUTE_with?= =?utf-8?q?_DEFINE=5FDEBUGFS=5FATTRIBUTE?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2AN96HLb057157 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 637DE293.000 by FangMail milter! X-FangMail-Envelope: 1669194387/4NHFc36spTz4y0tt/637DE293.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/<zhang.songyi@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 637DE293.000/4NHFc36spTz4y0tt X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY 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?1750277269388501685?= X-GMAIL-MSGID: =?utf-8?q?1750277269388501685?= |
Series |
[linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
|
|
Commit Message
zhang.songyi@zte.com.cn
Nov. 23, 2022, 9:06 a.m. UTC
From: zhang songyi <zhang.songyi@zte.com.cn> Fix the following coccicheck warning: /arch/powerpc/platforms/cell/axon_msi.c:457:0-23: WARNING: fops_msic should be defined with DEFINE_DEBUGFS_ATTRIBUTE Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn> --- arch/powerpc/platforms/cell/axon_msi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.15.2
Comments
Hi, Le 23/11/2022 à 10:06, zhang.songyi@zte.com.cn a écrit : > From: zhang songyi <zhang.songyi@zte.com.cn> > > Fix the following coccicheck warning: > /arch/powerpc/platforms/cell/axon_msi.c:457:0-23: WARNING: > fops_msic should be defined with DEFINE_DEBUGFS_ATTRIBUTE What's the difference between this new patch and the one that is already awaiting application here : https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20211222090655.484551-1-deng.changcheng@zte.com.cn/ ? The only difference I see it that the already existing patch has a more complete description of the change, so unless I'm missing something it would be nice to avoid sending the same changes again and again. Thanks Christophe > > Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn> > --- > arch/powerpc/platforms/cell/axon_msi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c > index 5b012abca773..ab080b5022ff 100644 > --- a/arch/powerpc/platforms/cell/axon_msi.c > +++ b/arch/powerpc/platforms/cell/axon_msi.c > @@ -454,7 +454,7 @@ static int msic_get(void *data, u64 *val) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(fops_msic, msic_get, msic_set, "%llu\n"); > +DEFINE_DEBUGFS_ATTRIBUTE(fops_msic, msic_get, msic_set, "%llu\n"); > > void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) > { > @@ -475,6 +475,7 @@ void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) > > snprintf(name, sizeof(name), "msic_%d", of_node_to_nid(dn)); > > - debugfs_create_file(name, 0600, arch_debugfs_dir, msic, &fops_msic); > + debugfs_create_file_unsafe(name, 0600, arch_debugfs_dir, > + msic, &fops_msic); > } > #endif /* DEBUG */ > -- > 2.15.2
Christophe Leroy <christophe.leroy@csgroup.eu> writes: > Hi, > > Le 23/11/2022 à 10:06, zhang.songyi@zte.com.cn a écrit : >> From: zhang songyi <zhang.songyi@zte.com.cn> >> >> Fix the following coccicheck warning: >> /arch/powerpc/platforms/cell/axon_msi.c:457:0-23: WARNING: >> fops_msic should be defined with DEFINE_DEBUGFS_ATTRIBUTE > > What's the difference between this new patch and the one that is already > awaiting application here : > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20211222090655.484551-1-deng.changcheng@zte.com.cn/ > ? > > The only difference I see it that the already existing patch has a more > complete description of the change, so unless I'm missing something it > would be nice to avoid sending the same changes again and again. Both patches switch the code to use a function called "unsafe" without adequately explaining why that is OK. The commit that added the cocci check script says: If the original struct file_operations are known to be safe against removal races by themselves already, the proxy creation may be bypassed by creating the files through debugfs_create_file_unsafe(). None of these conversion patches ever contain any explanation which speaks to that. In this case I *think* the change is OK and there is no race because the debugfs file is never removed. But I really wish the submitter would tell me that in the change log. cheers
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index 5b012abca773..ab080b5022ff 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -454,7 +454,7 @@ static int msic_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_msic, msic_get, msic_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_msic, msic_get, msic_set, "%llu\n"); void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) { @@ -475,6 +475,7 @@ void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) snprintf(name, sizeof(name), "msic_%d", of_node_to_nid(dn)); - debugfs_create_file(name, 0600, arch_debugfs_dir, msic, &fops_msic); + debugfs_create_file_unsafe(name, 0600, arch_debugfs_dir, + msic, &fops_msic); } #endif /* DEBUG */