Skip to contentSkip to conversation

net: Use kobj_to_dev() API

PATCH Applied Wang Qing 2 participants 2 messages Sep 26, 2020 – Sep 28, 2020

Subsystems (3)
lore
Share & tools
lore

Wang Qing

author
#0 lore raw

PATCH 1/1 net: Use kobj_to_dev() API

Use kobj_to_dev() instead of container_of().

---
 drivers/net/phy/spi_ks8995.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/spi_ks8995.c +2 -2
index 7475cef..ca49c1a
@@ -300,7 +300,7 @@ static ssize_t ks8995_registers_read(struct file *filp, struct kobject *kobj,
 	struct device *dev;
 	struct ks8995_switch *ks8995;
 
-	dev = container_of(kobj, struct device, kobj);
+	dev = kobj_to_dev(kobj);
 	ks8995 = dev_get_drvdata(dev);
 
 	return ks8995_read(ks8995, buf, off, count);
@@ -312,7 +312,7 @@ static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
 	struct device *dev;
 	struct ks8995_switch *ks8995;
 
-	dev = container_of(kobj, struct device, kobj);
+	dev = kobj_to_dev(kobj);
 	ks8995 = dev_get_drvdata(dev);
 
 	return ks8995_write(ks8995, buf, off, count);
Signature · 1 line
2.7.4