* [PATCH v3 -next] ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files
@ 2019-01-02 13:18 YueHaibing
2019-01-14 10:51 ` Borislav Petkov
2019-01-15 18:43 ` Rafael J. Wysocki
0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2019-01-02 13:18 UTC (permalink / raw)
To: kernel-janitors
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files to make debugfs_simple_attr.cocci warnings go away.
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 <yuehaibing@huawei.com>
---
v3: add semantic patch information
v2: fix patch title and log
---
drivers/acpi/apei/einj.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index fcccbfd..6119da1 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -644,8 +644,8 @@ static int error_type_set(void *data, u64 val)
return 0;
}
-DEFINE_SIMPLE_ATTRIBUTE(error_type_fops, error_type_get,
- error_type_set, "0x%llx\n");
+DEFINE_DEBUGFS_ATTRIBUTE(error_type_fops, error_type_get, error_type_set,
+ "0x%llx\n");
static int error_inject_set(void *data, u64 val)
{
@@ -656,8 +656,7 @@ static int error_inject_set(void *data, u64 val)
error_param3, error_param4);
}
-DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops, NULL,
- error_inject_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(error_inject_fops, NULL, error_inject_set, "%llu\n");
static int einj_check_table(struct acpi_table_einj *einj_tab)
{
@@ -718,12 +717,14 @@ static int __init einj_init(void)
if (!fentry)
goto err_cleanup;
- fentry = debugfs_create_file("error_type", S_IRUSR | S_IWUSR,
- einj_debug_dir, NULL, &error_type_fops);
+ fentry = debugfs_create_file_unsafe("error_type", 0600,
+ einj_debug_dir, NULL,
+ &error_type_fops);
if (!fentry)
goto err_cleanup;
- fentry = debugfs_create_file("error_inject", S_IWUSR,
- einj_debug_dir, NULL, &error_inject_fops);
+ fentry = debugfs_create_file_unsafe("error_inject", 0200,
+ einj_debug_dir, NULL,
+ &error_inject_fops);
if (!fentry)
goto err_cleanup;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 -next] ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files
2019-01-02 13:18 [PATCH v3 -next] ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files YueHaibing
@ 2019-01-14 10:51 ` Borislav Petkov
2019-01-15 18:43 ` Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2019-01-14 10:51 UTC (permalink / raw)
To: kernel-janitors
On Wed, Jan 02, 2019 at 01:18:08PM +0000, YueHaibing wrote:
> Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
> for debugfs files to make debugfs_simple_attr.cocci warnings go away.
>
> 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 <yuehaibing@huawei.com>
> ---
> v3: add semantic patch information
> v2: fix patch title and log
> ---
> drivers/acpi/apei/einj.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
Acked-by: Borislav Petkov <bp@suse.de>
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 -next] ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files
2019-01-02 13:18 [PATCH v3 -next] ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files YueHaibing
2019-01-14 10:51 ` Borislav Petkov
@ 2019-01-15 18:43 ` Rafael J. Wysocki
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-01-15 18:43 UTC (permalink / raw)
To: kernel-janitors
On Monday, January 14, 2019 11:51:51 AM CET Borislav Petkov wrote:
> On Wed, Jan 02, 2019 at 01:18:08PM +0000, YueHaibing wrote:
> > Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
> > for debugfs files to make debugfs_simple_attr.cocci warnings go away.
> >
> > 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 <yuehaibing@huawei.com>
> > ---
> > v3: add semantic patch information
> > v2: fix patch title and log
> > ---
> > drivers/acpi/apei/einj.c | 17 +++++++++--------
> > 1 file changed, 9 insertions(+), 8 deletions(-)
>
> Acked-by: Borislav Petkov <bp@suse.de>
Patch applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-15 18:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-02 13:18 [PATCH v3 -next] ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files YueHaibing
2019-01-14 10:51 ` Borislav Petkov
2019-01-15 18:43 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.