Commit b0ebbaee authored by dongjian's avatar dongjian Committed by Greg Kroah-Hartman

w1: Use kobj_to_dev()[RESEND]

Use kobj_to_dev() instead of open-coding it
Signed-off-by: default avatardongjian <dongjian@yulong.com>
Link: https://lore.kernel.org/r/1615877987-32163-1-git-send-email-dj0227@163.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 199c4d0e
...@@ -90,7 +90,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, ...@@ -90,7 +90,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf, struct bin_attribute *bin_attr, char *buf,
loff_t off, size_t count) 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); return w1_ds2780_io(dev, buf, off, count, 0);
} }
......
...@@ -87,7 +87,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, ...@@ -87,7 +87,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf, struct bin_attribute *bin_attr, char *buf,
loff_t off, size_t count) 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); return w1_ds2781_io(dev, buf, off, count, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment