lkml.org 
[lkml]   [2021]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] power: supply: ds2780: Switch to using the new API kobj_to_dev()
Hi,

On Tue, Dec 15, 2020 at 09:00:24AM +0800, Tian Tao wrote:
> 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>
> ---

Thanks, queued.

-- Sebastian

> drivers/power/supply/ds2780_battery.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/power/supply/ds2780_battery.c b/drivers/power/supply/ds2780_battery.c
> index dd57a47..2b8c90d 100644
> --- a/drivers/power/supply/ds2780_battery.c
> +++ b/drivers/power/supply/ds2780_battery.c
> @@ -624,7 +624,7 @@ static ssize_t ds2780_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 ds2780_device_info *dev_info = to_ds2780_device_info(psy);
>
> @@ -637,7 +637,7 @@ static ssize_t ds2780_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 ds2780_device_info *dev_info = to_ds2780_device_info(psy);
> int ret;
> @@ -669,7 +669,7 @@ static ssize_t ds2780_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 ds2780_device_info *dev_info = to_ds2780_device_info(psy);
>
> @@ -682,7 +682,7 @@ static ssize_t ds2780_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 ds2780_device_info *dev_info = to_ds2780_device_info(psy);
> int ret;
> --
> 2.7.4
>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-01-16 12:39    [W:0.046 / U:5.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site