From b0ebbaeee3d78a68d3413bdaeb707e527c5d4dbe Mon Sep 17 00:00:00 2001 From: dongjian Date: Tue, 16 Mar 2021 14:59:47 +0800 Subject: w1: Use kobj_to_dev()[RESEND] Use kobj_to_dev() instead of open-coding it Signed-off-by: dongjian Link: https://lore.kernel.org/r/1615877987-32163-1-git-send-email-dj0227@163.com Signed-off-by: Greg Kroah-Hartman --- drivers/w1/slaves/w1_ds2780.c | 2 +- drivers/w1/slaves/w1_ds2781.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/w1') diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c index c281fe5ed688..9dcb5a54f7fc 100644 --- a/drivers/w1/slaves/w1_ds2780.c +++ b/drivers/w1/slaves/w1_ds2780.c @@ -90,7 +90,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_ds2780_io(dev, buf, off, count, 0); } diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c index f0d393ae070b..2cb7c020b607 100644 --- a/drivers/w1/slaves/w1_ds2781.c +++ b/drivers/w1/slaves/w1_ds2781.c @@ -87,7 +87,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_ds2781_io(dev, buf, off, count, 0); } -- cgit v1.2.3