From: Guenter Roeck <linux@roeck-us.net>
To: zhouchuangao <chuangaozhou@gmail.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org,
zhouchuangao <zhouchuangao@xiaomi.com>
Subject: Re: [PATCH] driver/hwmon/nct6775: Use kobj_to_dev() API
Date: Mon, 11 May 2020 09:47:34 -0700 [thread overview]
Message-ID: <20200511164734.GA23709@roeck-us.net> (raw)
On Mon, May 11, 2020 at 11:43:06AM +0800, zhouchuangao wrote:
> Use kobj_to_dev() API instead of container_of().
>
> Signed-off-by: zhouchuangao <zhouchuangao@xiaomi.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/nct6775.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
> index 7efa6bf..e7e1ddc 100644
> --- a/drivers/hwmon/nct6775.c
> +++ b/drivers/hwmon/nct6775.c
> @@ -2047,7 +2047,7 @@ store_temp_beep(struct device *dev, struct device_attribute *attr,
> static umode_t nct6775_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 nct6775_data *data = dev_get_drvdata(dev);
> int in = index / 5; /* voltage index */
>
> @@ -2253,7 +2253,7 @@ store_fan_pulses(struct device *dev, struct device_attribute *attr,
> static umode_t nct6775_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 nct6775_data *data = dev_get_drvdata(dev);
> int fan = index / 6; /* fan index */
> int nr = index % 6; /* attribute index */
> @@ -2440,7 +2440,7 @@ store_temp_type(struct device *dev, struct device_attribute *attr,
> static umode_t nct6775_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 nct6775_data *data = dev_get_drvdata(dev);
> int temp = index / 10; /* temp index */
> int nr = index % 10; /* attribute index */
> @@ -3257,7 +3257,7 @@ store_auto_temp(struct device *dev, struct device_attribute *attr,
> static umode_t nct6775_pwm_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 nct6775_data *data = dev_get_drvdata(dev);
> int pwm = index / 36; /* pwm index */
> int nr = index % 36; /* attribute index */
> @@ -3459,7 +3459,7 @@ static SENSOR_DEVICE_ATTR(beep_enable, S_IWUSR | S_IRUGO, show_beep,
> static umode_t nct6775_other_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 nct6775_data *data = dev_get_drvdata(dev);
>
> if (index == 0 && !data->have_vid)
> --
> 2.7.4
>
next reply other threads:[~2020-05-11 16:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 16:47 Guenter Roeck [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-05-11 3:43 [PATCH] driver/hwmon/nct6775: Use kobj_to_dev() API zhouchuangao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200511164734.GA23709@roeck-us.net \
--to=linux@roeck-us.net \
--cc=chuangaozhou@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhouchuangao@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox