Skip to content

Commit 23fd63a

Browse files
Wang Qinggroeck
authored andcommitted
hwmon: (nct6683) Replace container_of() with kobj_to_dev()
Use kobj_to_dev() instead of container_of(). Signed-off-by: Wang Qing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 9e44423 commit 23fd63a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/hwmon/nct6683.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
674674
static umode_t nct6683_in_is_visible(struct kobject *kobj,
675675
struct attribute *attr, int index)
676676
{
677-
struct device *dev = container_of(kobj, struct device, kobj);
677+
struct device *dev = kobj_to_dev(kobj);
678678
struct nct6683_data *data = dev_get_drvdata(dev);
679679
int nr = index % 4; /* attribute */
680680

@@ -739,7 +739,7 @@ show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf)
739739
static umode_t nct6683_fan_is_visible(struct kobject *kobj,
740740
struct attribute *attr, int index)
741741
{
742-
struct device *dev = container_of(kobj, struct device, kobj);
742+
struct device *dev = kobj_to_dev(kobj);
743743
struct nct6683_data *data = dev_get_drvdata(dev);
744744
int fan = index / 3; /* fan index */
745745
int nr = index % 3; /* attribute index */
@@ -857,7 +857,7 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
857857
static umode_t nct6683_temp_is_visible(struct kobject *kobj,
858858
struct attribute *attr, int index)
859859
{
860-
struct device *dev = container_of(kobj, struct device, kobj);
860+
struct device *dev = kobj_to_dev(kobj);
861861
struct nct6683_data *data = dev_get_drvdata(dev);
862862
int temp = index / 7; /* temp index */
863863
int nr = index % 7; /* attribute index */
@@ -944,7 +944,7 @@ SENSOR_TEMPLATE(pwm, "pwm%d", S_IRUGO, show_pwm, store_pwm, 0);
944944
static umode_t nct6683_pwm_is_visible(struct kobject *kobj,
945945
struct attribute *attr, int index)
946946
{
947-
struct device *dev = container_of(kobj, struct device, kobj);
947+
struct device *dev = kobj_to_dev(kobj);
948948
struct nct6683_data *data = dev_get_drvdata(dev);
949949
int pwm = index; /* pwm index */
950950

0 commit comments

Comments
 (0)