Skip to contentSkip to conversation

drivers/greybus: Use kobj_to_dev() instead

PATCH In review Wang Qing 3 participants 3 messages Aug 13, 2020 – Aug 17, 2020 Greybus

lore
Share & tools
lore

Wang Qing

author
#0 lore raw

PATCH 1/1 drivers/greybus: Use kobj_to_dev() instead

Use kobj_to_dev() instead of container_of()

---
 drivers/greybus/interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/greybus/interface.c +3 -3
index 67dbe6f..de167f1
@@ -620,7 +620,7 @@ static struct attribute *interface_common_attrs[] = {
 static umode_t interface_unipro_is_visible(struct kobject *kobj,
 					   struct attribute *attr, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct gb_interface *intf = to_gb_interface(dev);
 
 	switch (intf->type) {
@@ -635,7 +635,7 @@ static umode_t interface_unipro_is_visible(struct kobject *kobj,
 static umode_t interface_greybus_is_visible(struct kobject *kobj,
 					    struct attribute *attr, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct gb_interface *intf = to_gb_interface(dev);
 
 	switch (intf->type) {
@@ -649,7 +649,7 @@ static umode_t interface_greybus_is_visible(struct kobject *kobj,
 static umode_t interface_power_is_visible(struct kobject *kobj,
 					  struct attribute *attr, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct gb_interface *intf = to_gb_interface(dev);
 
 	switch (intf->type) {
Signature · 1 line
2.7.4