diff mbox series

power-supply: use kobj_to_dev()

Message ID 20210120014713.17668-1-dj0227@163.com (mailing list archive)
State Not Applicable, archived
Headers show
Series power-supply: use kobj_to_dev() | expand

Commit Message

Jian Dong Jan. 20, 2021, 1:47 a.m. UTC
From: dongjian <dongjian@yulong.com>

Use kobj_to_dev() instead of open-coding it

Signed-off-by: dongjian <dongjian@yulong.com>
---
 drivers/power/supply/ds2760_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sebastian Reichel Jan. 28, 2021, 12:32 a.m. UTC | #1
Hi,

On Wed, Jan 20, 2021 at 09:47:12AM +0800, Jian Dong wrote:
> From: dongjian <dongjian@yulong.com>
> 
> Use kobj_to_dev() instead of open-coding it
> 
> Signed-off-by: dongjian <dongjian@yulong.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/ds2760_battery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/ds2760_battery.c b/drivers/power/supply/ds2760_battery.c
> index 695bb67..5f50da5 100644
> --- a/drivers/power/supply/ds2760_battery.c
> +++ b/drivers/power/supply/ds2760_battery.c
> @@ -198,7 +198,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
>  			     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);
>  	return w1_ds2760_read(dev, buf, off, count);
>  }
>  
> -- 
> 1.9.1
> 
>
diff mbox series

Patch

diff --git a/drivers/power/supply/ds2760_battery.c b/drivers/power/supply/ds2760_battery.c
index 695bb67..5f50da5 100644
--- a/drivers/power/supply/ds2760_battery.c
+++ b/drivers/power/supply/ds2760_battery.c
@@ -198,7 +198,7 @@  static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
 			     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);
 	return w1_ds2760_read(dev, buf, off, count);
 }