Skip to content

Commit d06f9e6

Browse files
hailizhenggroeck
authored andcommitted
hwmon: (nct7802) Replace container_of() API
Replace container_of() API with kobj_to_dev(). Signed-off-by: hailizheng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 229d495 commit d06f9e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hwmon/nct7802.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ static struct attribute *nct7802_temp_attrs[] = {
679679
static umode_t nct7802_temp_is_visible(struct kobject *kobj,
680680
struct attribute *attr, int index)
681681
{
682-
struct device *dev = container_of(kobj, struct device, kobj);
682+
struct device *dev = kobj_to_dev(kobj);
683683
struct nct7802_data *data = dev_get_drvdata(dev);
684684
unsigned int reg;
685685
int err;
@@ -778,7 +778,7 @@ static struct attribute *nct7802_in_attrs[] = {
778778
static umode_t nct7802_in_is_visible(struct kobject *kobj,
779779
struct attribute *attr, int index)
780780
{
781-
struct device *dev = container_of(kobj, struct device, kobj);
781+
struct device *dev = kobj_to_dev(kobj);
782782
struct nct7802_data *data = dev_get_drvdata(dev);
783783
unsigned int reg;
784784
int err;
@@ -853,7 +853,7 @@ static struct attribute *nct7802_fan_attrs[] = {
853853
static umode_t nct7802_fan_is_visible(struct kobject *kobj,
854854
struct attribute *attr, int index)
855855
{
856-
struct device *dev = container_of(kobj, struct device, kobj);
856+
struct device *dev = kobj_to_dev(kobj);
857857
struct nct7802_data *data = dev_get_drvdata(dev);
858858
int fan = index / 4; /* 4 attributes per fan */
859859
unsigned int reg;

0 commit comments

Comments
 (0)