Commit 036855a4 authored by zhouchuangao's avatar zhouchuangao Committed by Guenter Roeck

hwmon : (nct6775) Use kobj_to_dev() API

Use kobj_to_dev() API instead of container_of().
Signed-off-by: default avatarzhouchuangao <zhouchuangao@xiaomi.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 2138f885
...@@ -2047,7 +2047,7 @@ store_temp_beep(struct device *dev, struct device_attribute *attr, ...@@ -2047,7 +2047,7 @@ store_temp_beep(struct device *dev, struct device_attribute *attr,
static umode_t nct6775_in_is_visible(struct kobject *kobj, static umode_t nct6775_in_is_visible(struct kobject *kobj,
struct attribute *attr, int index) 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); struct nct6775_data *data = dev_get_drvdata(dev);
int in = index / 5; /* voltage index */ int in = index / 5; /* voltage index */
...@@ -2253,7 +2253,7 @@ store_fan_pulses(struct device *dev, struct device_attribute *attr, ...@@ -2253,7 +2253,7 @@ store_fan_pulses(struct device *dev, struct device_attribute *attr,
static umode_t nct6775_fan_is_visible(struct kobject *kobj, static umode_t nct6775_fan_is_visible(struct kobject *kobj,
struct attribute *attr, int index) 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); struct nct6775_data *data = dev_get_drvdata(dev);
int fan = index / 6; /* fan index */ int fan = index / 6; /* fan index */
int nr = index % 6; /* attribute index */ int nr = index % 6; /* attribute index */
...@@ -2440,7 +2440,7 @@ store_temp_type(struct device *dev, struct device_attribute *attr, ...@@ -2440,7 +2440,7 @@ store_temp_type(struct device *dev, struct device_attribute *attr,
static umode_t nct6775_temp_is_visible(struct kobject *kobj, static umode_t nct6775_temp_is_visible(struct kobject *kobj,
struct attribute *attr, int index) 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); struct nct6775_data *data = dev_get_drvdata(dev);
int temp = index / 10; /* temp index */ int temp = index / 10; /* temp index */
int nr = index % 10; /* attribute index */ int nr = index % 10; /* attribute index */
...@@ -3257,7 +3257,7 @@ store_auto_temp(struct device *dev, struct device_attribute *attr, ...@@ -3257,7 +3257,7 @@ store_auto_temp(struct device *dev, struct device_attribute *attr,
static umode_t nct6775_pwm_is_visible(struct kobject *kobj, static umode_t nct6775_pwm_is_visible(struct kobject *kobj,
struct attribute *attr, int index) 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); struct nct6775_data *data = dev_get_drvdata(dev);
int pwm = index / 36; /* pwm index */ int pwm = index / 36; /* pwm index */
int nr = index % 36; /* attribute index */ int nr = index % 36; /* attribute index */
...@@ -3459,7 +3459,7 @@ static SENSOR_DEVICE_ATTR(beep_enable, S_IWUSR | S_IRUGO, show_beep, ...@@ -3459,7 +3459,7 @@ static SENSOR_DEVICE_ATTR(beep_enable, S_IWUSR | S_IRUGO, show_beep,
static umode_t nct6775_other_is_visible(struct kobject *kobj, static umode_t nct6775_other_is_visible(struct kobject *kobj,
struct attribute *attr, int index) 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); struct nct6775_data *data = dev_get_drvdata(dev);
if (index == 0 && !data->have_vid) if (index == 0 && !data->have_vid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment