* [PATCH linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
@ 2022-11-23 9:06 zhang.songyi
2022-11-23 13:42 ` Christophe Leroy
0 siblings, 1 reply; 3+ messages in thread
From: zhang.songyi @ 2022-11-23 9:06 UTC (permalink / raw)
To: arnd; +Cc: linux-kernel, npiggin, linuxppc-dev, zhang.songyi
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(-)
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
2022-11-23 9:06 [PATCH linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE zhang.songyi
@ 2022-11-23 13:42 ` Christophe Leroy
2022-11-25 5:30 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy @ 2022-11-23 13:42 UTC (permalink / raw)
To: zhang.songyi@zte.com.cn, arnd@arndb.de
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
npiggin@gmail.com
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
2022-11-23 13:42 ` Christophe Leroy
@ 2022-11-25 5:30 ` Michael Ellerman
0 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-11-25 5:30 UTC (permalink / raw)
To: Christophe Leroy, zhang.songyi@zte.com.cn, arnd@arndb.de
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
npiggin@gmail.com, deng.changcheng
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-25 5:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23 9:06 [PATCH linux-next] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE zhang.songyi
2022-11-23 13:42 ` Christophe Leroy
2022-11-25 5:30 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox