Skip to content

Commit

Permalink
hwmon: (asus_atk0110) Fix debugfs_simple_attr.cocci warnings
Browse files Browse the repository at this point in the history
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.

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>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
YueHaibing authored and groeck committed Dec 16, 2018
1 parent 626f5ea commit f9facc2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/hwmon/asus_atk0110.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,8 @@ static int atk_debugfs_gitm_get(void *p, u64 *val)
return err;
}

DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm,
atk_debugfs_gitm_get,
NULL,
"0x%08llx\n");
DEFINE_DEBUGFS_ATTRIBUTE(atk_debugfs_gitm, atk_debugfs_gitm_get, NULL,
"0x%08llx\n");

static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj)
{
Expand Down Expand Up @@ -803,8 +801,8 @@ static void atk_debugfs_init(struct atk_data *data)
if (!f || IS_ERR(f))
goto cleanup;

f = debugfs_create_file("gitm", 0400, d, data,
&atk_debugfs_gitm);
f = debugfs_create_file_unsafe("gitm", 0400, d, data,
&atk_debugfs_gitm);
if (!f || IS_ERR(f))
goto cleanup;

Expand Down

0 comments on commit f9facc2

Please sign in to comment.