power-supply: use kobj_to_dev()
PATCH 1/1 power-supply: use kobj_to_dev()
From: dongjian <[email protected]>
Use kobj_to_dev() instead of open-coding it
Signed-off-by dongjian <[email protected]>
--- drivers/power/supply/ds2781_battery.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/power/supply/ds2781_battery.c +4 -4
@@ -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;
Signature · 1 line
1.9.1
Sebastian Reichel
maintainerHi,
Quoted 6 lines · Jian Dong
From: dongjian <[email protected]>
Use
kobj_to_dev()instead of open-coding itSigned-off-by dongjian <[email protected]>---
Thanks, queued.
-- Sebastian
Quoted 46 lines
drivers/power/supply/ds2781_battery.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/power/supply/ds2781_battery.c +4
-4@@ -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;Signature · 1 line
1.9.1