From: Tian Tao Date: Tue, 1 Sep 2020 08:27:17 +0000 (+0800) Subject: thunderbolt: Use kobj_to_dev() instead of container_of() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=fff15f23b8e74c2f969a5d25f29d0565e76e7137;p=linux.git thunderbolt: Use kobj_to_dev() instead of container_of() Doesn't really matter for an individual driver, but it may get coppied to lots more. I consider it's a little tidy up. Signed-off-by: Tian Tao Signed-off-by: Mika Westerberg --- diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c index bba4cbfa9759b..7a192b7ea85e6 100644 --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c @@ -275,7 +275,7 @@ static struct attribute *domain_attrs[] = { static umode_t domain_attr_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 tb *tb = container_of(dev, struct tb, dev); if (attr == &dev_attr_boot_acl.attr) { diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 3845db569e4c4..99effd6be3c18 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -1648,7 +1648,7 @@ static struct attribute *switch_attrs[] = { static umode_t switch_attr_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 tb_switch *sw = tb_to_switch(dev); if (attr == &dev_attr_device.attr) {