Commit 23fd63a4 authored by Wang Qing's avatar Wang Qing Committed by Guenter Roeck

hwmon: (nct6683) Replace container_of() with kobj_to_dev()

Use kobj_to_dev() instead of container_of().
Signed-off-by: default avatarWang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1592035604-22336-1-git-send-email-wangqing@vivo.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 9e444234
...@@ -674,7 +674,7 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -674,7 +674,7 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
static umode_t nct6683_in_is_visible(struct kobject *kobj, static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev); struct nct6683_data *data = dev_get_drvdata(dev);
int nr = index % 4; /* attribute */ int nr = index % 4; /* attribute */
...@@ -739,7 +739,7 @@ show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -739,7 +739,7 @@ show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf)
static umode_t nct6683_fan_is_visible(struct kobject *kobj, static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev); struct nct6683_data *data = dev_get_drvdata(dev);
int fan = index / 3; /* fan index */ int fan = index / 3; /* fan index */
int nr = index % 3; /* attribute index */ int nr = index % 3; /* attribute index */
...@@ -857,7 +857,7 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -857,7 +857,7 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
static umode_t nct6683_temp_is_visible(struct kobject *kobj, static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev); struct nct6683_data *data = dev_get_drvdata(dev);
int temp = index / 7; /* temp index */ int temp = index / 7; /* temp index */
int nr = index % 7; /* attribute index */ int nr = index % 7; /* attribute index */
...@@ -944,7 +944,7 @@ SENSOR_TEMPLATE(pwm, "pwm%d", S_IRUGO, show_pwm, store_pwm, 0); ...@@ -944,7 +944,7 @@ SENSOR_TEMPLATE(pwm, "pwm%d", S_IRUGO, show_pwm, store_pwm, 0);
static umode_t nct6683_pwm_is_visible(struct kobject *kobj, static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev); struct nct6683_data *data = dev_get_drvdata(dev);
int pwm = index; /* pwm index */ int pwm = index; /* pwm index */
......
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