summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/apei
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-01-02 14:18:08 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-01-14 11:55:45 +0100
commitee9fa8f302dc1df10583fc043a91003e0a332d1b (patch)
treeaa329917d1f3ed078abc78deb671956a3ffa4475 /drivers/acpi/apei
parentACPI / APEI: Fix parsing HEST that includes Deferred Machine Check subtable (diff)
downloadlinux-ee9fa8f302dc1df10583fc043a91003e0a332d1b.tar.xz
linux-ee9fa8f302dc1df10583fc043a91003e0a332d1b.zip
ACPI: APEI: EINJ: Use DEFINE_DEBUGFS_ATTRIBUTE for debugfs files
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> Acked-by: Borislav Petkov <bp@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/apei')
-rw-r--r--drivers/acpi/apei/einj.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index fcccbfdbdd1a..6119da1aea4e 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;