Skip to contentSkip to conversation

w1: Use kobj_to_dev()[RESEND]

PATCH New Jian Dong 1 participant 1 message Mar 16, 2021 W1 dallas's 1-wire bus

lore
Share & tools
lore

Jian Dong

author
#0 lore raw

PATCH 1/1 w1: Use kobj_to_dev()[RESEND]

From: dongjian <[email protected]>

Use kobj_to_dev() instead of open-coding it

---
 drivers/w1/slaves/w1_ds2780.c | 2 +-
 drivers/w1/slaves/w1_ds2781.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/w1/slaves/w1_ds2780.c +1 -1
index c281fe5..9dcb5a5 100644
@@ -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);
 }
 
drivers/w1/slaves/w1_ds2781.c +1 -1
index f0d393a..2cb7c02 100644
@@ -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);
 }
 
Signature · 1 line
1.9.1