Skip to content

Commit 036855a

Browse files
zhouchuangaogroeck
authored andcommitted
hwmon : (nct6775) Use kobj_to_dev() API
Use kobj_to_dev() API instead of container_of(). Signed-off-by: zhouchuangao <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 2138f88 commit 036855a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/hwmon/nct6775.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ store_temp_beep(struct device *dev, struct device_attribute *attr,
20472047
static umode_t nct6775_in_is_visible(struct kobject *kobj,
20482048
struct attribute *attr, int index)
20492049
{
2050-
struct device *dev = container_of(kobj, struct device, kobj);
2050+
struct device *dev = kobj_to_dev(kobj);
20512051
struct nct6775_data *data = dev_get_drvdata(dev);
20522052
int in = index / 5; /* voltage index */
20532053

@@ -2253,7 +2253,7 @@ store_fan_pulses(struct device *dev, struct device_attribute *attr,
22532253
static umode_t nct6775_fan_is_visible(struct kobject *kobj,
22542254
struct attribute *attr, int index)
22552255
{
2256-
struct device *dev = container_of(kobj, struct device, kobj);
2256+
struct device *dev = kobj_to_dev(kobj);
22572257
struct nct6775_data *data = dev_get_drvdata(dev);
22582258
int fan = index / 6; /* fan index */
22592259
int nr = index % 6; /* attribute index */
@@ -2440,7 +2440,7 @@ store_temp_type(struct device *dev, struct device_attribute *attr,
24402440
static umode_t nct6775_temp_is_visible(struct kobject *kobj,
24412441
struct attribute *attr, int index)
24422442
{
2443-
struct device *dev = container_of(kobj, struct device, kobj);
2443+
struct device *dev = kobj_to_dev(kobj);
24442444
struct nct6775_data *data = dev_get_drvdata(dev);
24452445
int temp = index / 10; /* temp index */
24462446
int nr = index % 10; /* attribute index */
@@ -3257,7 +3257,7 @@ store_auto_temp(struct device *dev, struct device_attribute *attr,
32573257
static umode_t nct6775_pwm_is_visible(struct kobject *kobj,
32583258
struct attribute *attr, int index)
32593259
{
3260-
struct device *dev = container_of(kobj, struct device, kobj);
3260+
struct device *dev = kobj_to_dev(kobj);
32613261
struct nct6775_data *data = dev_get_drvdata(dev);
32623262
int pwm = index / 36; /* pwm index */
32633263
int nr = index % 36; /* attribute index */
@@ -3459,7 +3459,7 @@ static SENSOR_DEVICE_ATTR(beep_enable, S_IWUSR | S_IRUGO, show_beep,
34593459
static umode_t nct6775_other_is_visible(struct kobject *kobj,
34603460
struct attribute *attr, int index)
34613461
{
3462-
struct device *dev = container_of(kobj, struct device, kobj);
3462+
struct device *dev = kobj_to_dev(kobj);
34633463
struct nct6775_data *data = dev_get_drvdata(dev);
34643464

34653465
if (index == 0 && !data->have_vid)

0 commit comments

Comments
 (0)