| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * nct6683 - Driver for the hardware monitoring functionality of |
|---|
| 3 | 4 | * Nuvoton NCT6683D eSIO |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Derived from nct6775 driver |
|---|
| 8 | 9 | * 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. |
|---|
| 19 | 10 | * |
|---|
| 20 | 11 | * Supports the following chips: |
|---|
| 21 | 12 | * |
|---|
| .. | .. |
|---|
| 683 | 674 | static umode_t nct6683_in_is_visible(struct kobject *kobj, |
|---|
| 684 | 675 | struct attribute *attr, int index) |
|---|
| 685 | 676 | { |
|---|
| 686 | | - struct device *dev = container_of(kobj, struct device, kobj); |
|---|
| 677 | + struct device *dev = kobj_to_dev(kobj); |
|---|
| 687 | 678 | struct nct6683_data *data = dev_get_drvdata(dev); |
|---|
| 688 | 679 | int nr = index % 4; /* attribute */ |
|---|
| 689 | 680 | |
|---|
| .. | .. |
|---|
| 748 | 739 | static umode_t nct6683_fan_is_visible(struct kobject *kobj, |
|---|
| 749 | 740 | struct attribute *attr, int index) |
|---|
| 750 | 741 | { |
|---|
| 751 | | - struct device *dev = container_of(kobj, struct device, kobj); |
|---|
| 742 | + struct device *dev = kobj_to_dev(kobj); |
|---|
| 752 | 743 | struct nct6683_data *data = dev_get_drvdata(dev); |
|---|
| 753 | 744 | int fan = index / 3; /* fan index */ |
|---|
| 754 | 745 | int nr = index % 3; /* attribute index */ |
|---|
| .. | .. |
|---|
| 866 | 857 | static umode_t nct6683_temp_is_visible(struct kobject *kobj, |
|---|
| 867 | 858 | struct attribute *attr, int index) |
|---|
| 868 | 859 | { |
|---|
| 869 | | - struct device *dev = container_of(kobj, struct device, kobj); |
|---|
| 860 | + struct device *dev = kobj_to_dev(kobj); |
|---|
| 870 | 861 | struct nct6683_data *data = dev_get_drvdata(dev); |
|---|
| 871 | 862 | int temp = index / 7; /* temp index */ |
|---|
| 872 | 863 | int nr = index % 7; /* attribute index */ |
|---|
| .. | .. |
|---|
| 953 | 944 | static umode_t nct6683_pwm_is_visible(struct kobject *kobj, |
|---|
| 954 | 945 | struct attribute *attr, int index) |
|---|
| 955 | 946 | { |
|---|
| 956 | | - struct device *dev = container_of(kobj, struct device, kobj); |
|---|
| 947 | + struct device *dev = kobj_to_dev(kobj); |
|---|
| 957 | 948 | struct nct6683_data *data = dev_get_drvdata(dev); |
|---|
| 958 | 949 | int pwm = index; /* pwm index */ |
|---|
| 959 | 950 | |
|---|