forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/hwmon/asus_atk0110.c
....@@ -1,7 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2007-2009 Luca Tettamanti <kronos.it@gmail.com>
34 *
4
- * This file is released under the GPLv2
55 * See COPYING in the top level directory of the kernel tree.
66 */
77
....@@ -681,10 +681,8 @@
681681 return err;
682682 }
683683
684
-DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm,
685
- atk_debugfs_gitm_get,
686
- NULL,
687
- "0x%08llx\n");
684
+DEFINE_DEBUGFS_ATTRIBUTE(atk_debugfs_gitm, atk_debugfs_gitm_get, NULL,
685
+ "0x%08llx\n");
688686
689687 static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj)
690688 {
....@@ -791,33 +789,16 @@
791789 static void atk_debugfs_init(struct atk_data *data)
792790 {
793791 struct dentry *d;
794
- struct dentry *f;
795792
796793 data->debugfs.id = 0;
797794
798795 d = debugfs_create_dir("asus_atk0110", NULL);
799
- if (!d || IS_ERR(d))
800
- return;
801796
802
- f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id);
803
- if (!f || IS_ERR(f))
804
- goto cleanup;
805
-
806
- f = debugfs_create_file("gitm", S_IRUSR, d, data,
807
- &atk_debugfs_gitm);
808
- if (!f || IS_ERR(f))
809
- goto cleanup;
810
-
811
- f = debugfs_create_file("ggrp", S_IRUSR, d, data,
812
- &atk_debugfs_ggrp_fops);
813
- if (!f || IS_ERR(f))
814
- goto cleanup;
797
+ debugfs_create_x32("id", 0600, d, &data->debugfs.id);
798
+ debugfs_create_file_unsafe("gitm", 0400, d, data, &atk_debugfs_gitm);
799
+ debugfs_create_file("ggrp", 0400, d, data, &atk_debugfs_ggrp_fops);
815800
816801 data->debugfs.root = d;
817
-
818
- return;
819
-cleanup:
820
- debugfs_remove_recursive(d);
821802 }
822803
823804 static void atk_debugfs_cleanup(struct atk_data *data)
....@@ -1210,10 +1191,8 @@
12101191 data->hwmon_dev = hwmon_device_register_with_groups(dev, "atk0110",
12111192 data,
12121193 data->attr_groups);
1213
- if (IS_ERR(data->hwmon_dev))
1214
- return PTR_ERR(data->hwmon_dev);
12151194
1216
- return 0;
1195
+ return PTR_ERR_OR_ZERO(data->hwmon_dev);
12171196 }
12181197
12191198 static int atk_probe_if(struct atk_data *data)