Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (nct6683) Replace container_of() with kobj_to_dev()

Use kobj_to_dev() instead of container_of().

Signed-off-by: Wang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1592035604-22336-1-git-send-email-wangqing@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Wang Qing and committed by
Guenter Roeck
23fd63a4 9e444234

+4 -4
+4 -4
drivers/hwmon/nct6683.c
··· 674 674 static umode_t nct6683_in_is_visible(struct kobject *kobj, 675 675 struct attribute *attr, int index) 676 676 { 677 - struct device *dev = container_of(kobj, struct device, kobj); 677 + struct device *dev = kobj_to_dev(kobj); 678 678 struct nct6683_data *data = dev_get_drvdata(dev); 679 679 int nr = index % 4; /* attribute */ 680 680 ··· 739 739 static umode_t nct6683_fan_is_visible(struct kobject *kobj, 740 740 struct attribute *attr, int index) 741 741 { 742 - struct device *dev = container_of(kobj, struct device, kobj); 742 + struct device *dev = kobj_to_dev(kobj); 743 743 struct nct6683_data *data = dev_get_drvdata(dev); 744 744 int fan = index / 3; /* fan index */ 745 745 int nr = index % 3; /* attribute index */ ··· 857 857 static umode_t nct6683_temp_is_visible(struct kobject *kobj, 858 858 struct attribute *attr, int index) 859 859 { 860 - struct device *dev = container_of(kobj, struct device, kobj); 860 + struct device *dev = kobj_to_dev(kobj); 861 861 struct nct6683_data *data = dev_get_drvdata(dev); 862 862 int temp = index / 7; /* temp index */ 863 863 int nr = index % 7; /* attribute index */ ··· 944 944 static umode_t nct6683_pwm_is_visible(struct kobject *kobj, 945 945 struct attribute *attr, int index) 946 946 { 947 - struct device *dev = container_of(kobj, struct device, kobj); 947 + struct device *dev = kobj_to_dev(kobj); 948 948 struct nct6683_data *data = dev_get_drvdata(dev); 949 949 int pwm = index; /* pwm index */ 950 950