forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/hwmon/nct6683.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * nct6683 - Driver for the hardware monitoring functionality of
34 * Nuvoton NCT6683D eSIO
....@@ -6,16 +7,6 @@
67 *
78 * Derived from nct6775 driver
89 * Copyright (C) 2012, 2013 Guenter Roeck <linux@roeck-us.net>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
1910 *
2011 * Supports the following chips:
2112 *
....@@ -683,7 +674,7 @@
683674 static umode_t nct6683_in_is_visible(struct kobject *kobj,
684675 struct attribute *attr, int index)
685676 {
686
- struct device *dev = container_of(kobj, struct device, kobj);
677
+ struct device *dev = kobj_to_dev(kobj);
687678 struct nct6683_data *data = dev_get_drvdata(dev);
688679 int nr = index % 4; /* attribute */
689680
....@@ -748,7 +739,7 @@
748739 static umode_t nct6683_fan_is_visible(struct kobject *kobj,
749740 struct attribute *attr, int index)
750741 {
751
- struct device *dev = container_of(kobj, struct device, kobj);
742
+ struct device *dev = kobj_to_dev(kobj);
752743 struct nct6683_data *data = dev_get_drvdata(dev);
753744 int fan = index / 3; /* fan index */
754745 int nr = index % 3; /* attribute index */
....@@ -866,7 +857,7 @@
866857 static umode_t nct6683_temp_is_visible(struct kobject *kobj,
867858 struct attribute *attr, int index)
868859 {
869
- struct device *dev = container_of(kobj, struct device, kobj);
860
+ struct device *dev = kobj_to_dev(kobj);
870861 struct nct6683_data *data = dev_get_drvdata(dev);
871862 int temp = index / 7; /* temp index */
872863 int nr = index % 7; /* attribute index */
....@@ -953,7 +944,7 @@
953944 static umode_t nct6683_pwm_is_visible(struct kobject *kobj,
954945 struct attribute *attr, int index)
955946 {
956
- struct device *dev = container_of(kobj, struct device, kobj);
947
+ struct device *dev = kobj_to_dev(kobj);
957948 struct nct6683_data *data = dev_get_drvdata(dev);
958949 int pwm = index; /* pwm index */
959950