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

power: supply: ds2780: Switch to using the new API kobj_to_dev()

fixed the following coccicheck:
drivers/power/supply/ds2780_battery.c:627:60-61: WARNING opportunity for
kobj_to_dev()
drivers/power/supply/ds2780_battery.c:672:60-61: WARNING opportunity for
kobj_to_dev()
drivers/power/supply/ds2780_battery.c:640:60-61: WARNING opportunity for
kobj_to_dev()
drivers/power/supply/ds2780_battery.c:685:60-61: WARNING opportunity for
kobj_to_dev()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Tian Tao and committed by
Sebastian Reichel
f856b2f2 3ed510f0

+4 -4
+4 -4
drivers/power/supply/ds2780_battery.c
··· 624 624 struct bin_attribute *bin_attr, 625 625 char *buf, loff_t off, size_t count) 626 626 { 627 - struct device *dev = container_of(kobj, struct device, kobj); 627 + struct device *dev = kobj_to_dev(kobj); 628 628 struct power_supply *psy = to_power_supply(dev); 629 629 struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); 630 630 ··· 637 637 struct bin_attribute *bin_attr, 638 638 char *buf, loff_t off, size_t count) 639 639 { 640 - struct device *dev = container_of(kobj, struct device, kobj); 640 + struct device *dev = kobj_to_dev(kobj); 641 641 struct power_supply *psy = to_power_supply(dev); 642 642 struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); 643 643 int ret; ··· 669 669 struct bin_attribute *bin_attr, 670 670 char *buf, loff_t off, size_t count) 671 671 { 672 - struct device *dev = container_of(kobj, struct device, kobj); 672 + struct device *dev = kobj_to_dev(kobj); 673 673 struct power_supply *psy = to_power_supply(dev); 674 674 struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); 675 675 ··· 682 682 struct bin_attribute *bin_attr, 683 683 char *buf, loff_t off, size_t count) 684 684 { 685 - struct device *dev = container_of(kobj, struct device, kobj); 685 + struct device *dev = kobj_to_dev(kobj); 686 686 struct power_supply *psy = to_power_supply(dev); 687 687 struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); 688 688 int ret;