static umode_t nct6775_in_is_visible(struct kobject *kobj,
                                     struct attribute *attr, int index)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct nct6775_data *data = dev_get_drvdata(dev);
        int in = index / 5;     /* voltage index */
 
 static umode_t nct6775_fan_is_visible(struct kobject *kobj,
                                      struct attribute *attr, int index)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct nct6775_data *data = dev_get_drvdata(dev);
        int fan = index / 6;    /* fan index */
        int nr = index % 6;     /* attribute index */
 static umode_t nct6775_temp_is_visible(struct kobject *kobj,
                                       struct attribute *attr, int index)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct nct6775_data *data = dev_get_drvdata(dev);
        int temp = index / 10;  /* temp index */
        int nr = index % 10;    /* attribute index */
 static umode_t nct6775_pwm_is_visible(struct kobject *kobj,
                                      struct attribute *attr, int index)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct nct6775_data *data = dev_get_drvdata(dev);
        int pwm = index / 36;   /* pwm index */
        int nr = index % 36;    /* attribute index */
 static umode_t nct6775_other_is_visible(struct kobject *kobj,
                                        struct attribute *attr, int index)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct nct6775_data *data = dev_get_drvdata(dev);
 
        if (index == 0 && !data->have_vid)