summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ds2781_battery.c
diff options
context:
space:
mode:
authordongjian <dongjian@yulong.com>2021-03-16 09:54:12 +0300
committerSebastian Reichel <sre@kernel.org>2021-03-22 17:05:41 +0300
commitc77b26e327dc09a53417dba87637824260389bf5 (patch)
treeaa0538edf95a2b006cb02e79c398782852f74429 /drivers/power/supply/ds2781_battery.c
parent31ba6fadc3ba55dce727f0213b30c87fc085a360 (diff)
downloadlinux-c77b26e327dc09a53417dba87637824260389bf5.tar.xz
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>
Diffstat (limited to 'drivers/power/supply/ds2781_battery.c')
-rw-r--r--drivers/power/supply/ds2781_battery.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/supply/ds2781_battery.c b/drivers/power/supply/ds2781_battery.c
index 3df3c820b38c..05b859bf2dc0 100644
--- a/drivers/power/supply/ds2781_battery.c
+++ b/drivers/power/supply/ds2781_battery.c
@@ -626,7 +626,7 @@ static ssize_t ds2781_read_param_eeprom_bin(struct file *filp,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct power_supply *psy = to_power_supply(dev);
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
@@ -639,7 +639,7 @@ static ssize_t ds2781_write_param_eeprom_bin(struct file *filp,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct power_supply *psy = to_power_supply(dev);
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
int ret;
@@ -671,7 +671,7 @@ static ssize_t ds2781_read_user_eeprom_bin(struct file *filp,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct power_supply *psy = to_power_supply(dev);
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
@@ -685,7 +685,7 @@ static ssize_t ds2781_write_user_eeprom_bin(struct file *filp,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct power_supply *psy = to_power_supply(dev);
struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
int ret;