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

hwmon: Use kobj_to_dev()

coccinelle complains about

WARNING opportunity for kobj_to_dev()

in several files, resulting in one-by-one patch submissions.
Handle all remaining instances in one go.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+12 -12
+1 -1
drivers/hwmon/adc128d818.c
··· 248 248 static umode_t adc128_is_visible(struct kobject *kobj, 249 249 struct attribute *attr, int index) 250 250 { 251 - struct device *dev = container_of(kobj, struct device, kobj); 251 + struct device *dev = kobj_to_dev(kobj); 252 252 struct adc128_data *data = dev_get_drvdata(dev); 253 253 254 254 if (index < ADC128_ATTR_NUM_VOLT) {
+6 -6
drivers/hwmon/it87.c
··· 1981 1981 static umode_t it87_in_is_visible(struct kobject *kobj, 1982 1982 struct attribute *attr, int index) 1983 1983 { 1984 - struct device *dev = container_of(kobj, struct device, kobj); 1984 + struct device *dev = kobj_to_dev(kobj); 1985 1985 struct it87_data *data = dev_get_drvdata(dev); 1986 1986 int i = index / 5; /* voltage index */ 1987 1987 int a = index % 5; /* attribute index */ ··· 2065 2065 static umode_t it87_temp_is_visible(struct kobject *kobj, 2066 2066 struct attribute *attr, int index) 2067 2067 { 2068 - struct device *dev = container_of(kobj, struct device, kobj); 2068 + struct device *dev = kobj_to_dev(kobj); 2069 2069 struct it87_data *data = dev_get_drvdata(dev); 2070 2070 int i = index / 7; /* temperature index */ 2071 2071 int a = index % 7; /* attribute index */ ··· 2126 2126 static umode_t it87_is_visible(struct kobject *kobj, 2127 2127 struct attribute *attr, int index) 2128 2128 { 2129 - struct device *dev = container_of(kobj, struct device, kobj); 2129 + struct device *dev = kobj_to_dev(kobj); 2130 2130 struct it87_data *data = dev_get_drvdata(dev); 2131 2131 2132 2132 if ((index == 2 || index == 3) && !data->has_vid) ··· 2158 2158 static umode_t it87_fan_is_visible(struct kobject *kobj, 2159 2159 struct attribute *attr, int index) 2160 2160 { 2161 - struct device *dev = container_of(kobj, struct device, kobj); 2161 + struct device *dev = kobj_to_dev(kobj); 2162 2162 struct it87_data *data = dev_get_drvdata(dev); 2163 2163 int i = index / 5; /* fan index */ 2164 2164 int a = index % 5; /* attribute index */ ··· 2229 2229 static umode_t it87_pwm_is_visible(struct kobject *kobj, 2230 2230 struct attribute *attr, int index) 2231 2231 { 2232 - struct device *dev = container_of(kobj, struct device, kobj); 2232 + struct device *dev = kobj_to_dev(kobj); 2233 2233 struct it87_data *data = dev_get_drvdata(dev); 2234 2234 int i = index / 4; /* pwm index */ 2235 2235 int a = index % 4; /* attribute index */ ··· 2290 2290 static umode_t it87_auto_pwm_is_visible(struct kobject *kobj, 2291 2291 struct attribute *attr, int index) 2292 2292 { 2293 - struct device *dev = container_of(kobj, struct device, kobj); 2293 + struct device *dev = kobj_to_dev(kobj); 2294 2294 struct it87_data *data = dev_get_drvdata(dev); 2295 2295 int i = index / 11; /* pwm index */ 2296 2296 int a = index % 11; /* attribute index */
+1 -1
drivers/hwmon/lm63.c
··· 931 931 static umode_t lm63_attribute_mode(struct kobject *kobj, 932 932 struct attribute *attr, int index) 933 933 { 934 - struct device *dev = container_of(kobj, struct device, kobj); 934 + struct device *dev = kobj_to_dev(kobj); 935 935 struct lm63_data *data = dev_get_drvdata(dev); 936 936 937 937 if (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr
+1 -1
drivers/hwmon/ltc2990.c
··· 153 153 static umode_t ltc2990_attrs_visible(struct kobject *kobj, 154 154 struct attribute *a, int n) 155 155 { 156 - struct device *dev = container_of(kobj, struct device, kobj); 156 + struct device *dev = kobj_to_dev(kobj); 157 157 struct ltc2990_data *data = dev_get_drvdata(dev); 158 158 struct device_attribute *da = 159 159 container_of(a, struct device_attribute, attr);
+2 -2
drivers/hwmon/max16065.c
··· 454 454 static umode_t max16065_basic_is_visible(struct kobject *kobj, 455 455 struct attribute *a, int n) 456 456 { 457 - struct device *dev = container_of(kobj, struct device, kobj); 457 + struct device *dev = kobj_to_dev(kobj); 458 458 struct max16065_data *data = dev_get_drvdata(dev); 459 459 int index = n / 4; 460 460 ··· 466 466 static umode_t max16065_secondary_is_visible(struct kobject *kobj, 467 467 struct attribute *a, int index) 468 468 { 469 - struct device *dev = container_of(kobj, struct device, kobj); 469 + struct device *dev = kobj_to_dev(kobj); 470 470 struct max16065_data *data = dev_get_drvdata(dev); 471 471 472 472 if (index >= data->num_adc)
+1 -1
drivers/hwmon/max6697.c
··· 460 460 static umode_t max6697_is_visible(struct kobject *kobj, struct attribute *attr, 461 461 int index) 462 462 { 463 - struct device *dev = container_of(kobj, struct device, kobj); 463 + struct device *dev = kobj_to_dev(kobj); 464 464 struct max6697_data *data = dev_get_drvdata(dev); 465 465 const struct max6697_chip_data *chip = data->chip; 466 466 int channel = index / 7; /* channel number */