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

power: supply: ds2781: use kobj_to_dev()

Use kobj_to_dev() instead of open-coding it

Signed-off-by: dongjian <dongjian@yulong.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

dongjian and committed by
Sebastian Reichel
c77b26e3 31ba6fad

+4 -4
+4 -4
drivers/power/supply/ds2781_battery.c
··· 626 626 struct bin_attribute *bin_attr, 627 627 char *buf, loff_t off, size_t count) 628 628 { 629 - struct device *dev = container_of(kobj, struct device, kobj); 629 + struct device *dev = kobj_to_dev(kobj); 630 630 struct power_supply *psy = to_power_supply(dev); 631 631 struct ds2781_device_info *dev_info = to_ds2781_device_info(psy); 632 632 ··· 639 639 struct bin_attribute *bin_attr, 640 640 char *buf, loff_t off, size_t count) 641 641 { 642 - struct device *dev = container_of(kobj, struct device, kobj); 642 + struct device *dev = kobj_to_dev(kobj); 643 643 struct power_supply *psy = to_power_supply(dev); 644 644 struct ds2781_device_info *dev_info = to_ds2781_device_info(psy); 645 645 int ret; ··· 671 671 struct bin_attribute *bin_attr, 672 672 char *buf, loff_t off, size_t count) 673 673 { 674 - struct device *dev = container_of(kobj, struct device, kobj); 674 + struct device *dev = kobj_to_dev(kobj); 675 675 struct power_supply *psy = to_power_supply(dev); 676 676 struct ds2781_device_info *dev_info = to_ds2781_device_info(psy); 677 677 ··· 685 685 struct bin_attribute *bin_attr, 686 686 char *buf, loff_t off, size_t count) 687 687 { 688 - struct device *dev = container_of(kobj, struct device, kobj); 688 + struct device *dev = kobj_to_dev(kobj); 689 689 struct power_supply *psy = to_power_supply(dev); 690 690 struct ds2781_device_info *dev_info = to_ds2781_device_info(psy); 691 691 int ret;