platform/x86: asus-wmi: Use kobj_to_dev()
authorye xingchen <ye.xingchen@zte.com.cn>
Thu, 11 Aug 2022 01:32:03 +0000 (01:32 +0000)
committerHans de Goede <hdegoede@redhat.com>
Thu, 25 Aug 2022 14:23:53 +0000 (16:23 +0200)
Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/20220811013203.16010-1-ye.xingchen@zte.com.cn
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/asus-wmi.c

index b5c977d37bc1ad695f8ef116b70dbb9a6d90bb8b..e461299d938ae6e445a33420121f52eff76939f7 100644 (file)
@@ -2006,7 +2006,7 @@ static struct attribute *hwmon_attributes[] = {
 static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
                                          struct attribute *attr, int idx)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct asus_wmi *asus = dev_get_drvdata(dev->parent);
        u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
 
@@ -3294,7 +3294,7 @@ static struct attribute *platform_attributes[] = {
 static umode_t asus_sysfs_is_visible(struct kobject *kobj,
                                    struct attribute *attr, int idx)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct asus_wmi *asus = dev_get_drvdata(dev);
        bool ok = true;
        int devid = -1;