Skip to content

Commit

Permalink
hwmon: (nct7802) Replace container_of() API
Browse files Browse the repository at this point in the history
Replace container_of() API with kobj_to_dev().

Signed-off-by: hailizheng <haili.zheng@powercore.com.cn>
Link: https://lore.kernel.org/r/1589891119-16508-1-git-send-email-haili.zheng@powercore.com.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
hailizheng authored and Guenter Roeck committed May 22, 2020
1 parent 229d495 commit d06f9e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/hwmon/nct7802.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ static struct attribute *nct7802_temp_attrs[] = {
static umode_t nct7802_temp_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct device *dev = kobj_to_dev(kobj);
struct nct7802_data *data = dev_get_drvdata(dev);
unsigned int reg;
int err;
Expand Down Expand Up @@ -778,7 +778,7 @@ static struct attribute *nct7802_in_attrs[] = {
static umode_t nct7802_in_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct device *dev = kobj_to_dev(kobj);
struct nct7802_data *data = dev_get_drvdata(dev);
unsigned int reg;
int err;
Expand Down Expand Up @@ -853,7 +853,7 @@ static struct attribute *nct7802_fan_attrs[] = {
static umode_t nct7802_fan_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct device *dev = kobj_to_dev(kobj);
struct nct7802_data *data = dev_get_drvdata(dev);
int fan = index / 4; /* 4 attributes per fan */
unsigned int reg;
Expand Down

0 comments on commit d06f9e6

Please sign in to comment.