* [PATCH] drivers/hwmon/nct7802: Replace container_of() API
@ 2020-05-19 12:25 zhenghaili
2020-05-22 13:22 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: zhenghaili @ 2020-05-19 12:25 UTC (permalink / raw)
To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel, hailizheng
From: hailizheng <haili.zheng@powercore.com.cn>
Replace container_of() API with kobj_to_dev().
Signed-off-by: hailizheng <haili.zheng@powercore.com.cn>
---
drivers/hwmon/nct7802.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
index 2e97e56..570df8e 100644
--- a/drivers/hwmon/nct7802.c
+++ b/drivers/hwmon/nct7802.c
@@ -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;
@@ -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;
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/hwmon/nct7802: Replace container_of() API
2020-05-19 12:25 [PATCH] drivers/hwmon/nct7802: Replace container_of() API zhenghaili
@ 2020-05-22 13:22 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-05-22 13:22 UTC (permalink / raw)
To: zhenghaili; +Cc: jdelvare, linux-hwmon, linux-kernel, hailizheng
On Tue, May 19, 2020 at 08:25:19AM -0400, zhenghaili wrote:
> From: hailizheng <haili.zheng@powercore.com.cn>
>
> Replace container_of() API with kobj_to_dev().
>
> Signed-off-by: hailizheng <haili.zheng@powercore.com.cn>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/nct7802.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
> index 2e97e56..570df8e 100644
> --- a/drivers/hwmon/nct7802.c
> +++ b/drivers/hwmon/nct7802.c
> @@ -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;
> @@ -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;
> @@ -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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-22 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 12:25 [PATCH] drivers/hwmon/nct7802: Replace container_of() API zhenghaili
2020-05-22 13:22 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).