* [PATCH] drivers/hwmon/nct6683: Use kobj_to_dev() instead
@ 2020-06-13 8:06 Wang Qing
2020-06-14 21:44 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Wang Qing @ 2020-06-13 8:06 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon, linux-kernel; +Cc: Wang Qing
Use kobj_to_dev() instead of container_of()
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
drivers/hwmon/nct6683.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
mode change 100644 => 100755 drivers/hwmon/nct6683.c
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index c022915..2d29914
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -674,7 +674,7 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
int nr = index % 4; /* attribute */
@@ -739,7 +739,7 @@ show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf)
static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
int fan = index / 3; /* fan index */
int nr = index % 3; /* attribute index */
@@ -857,7 +857,7 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
int temp = index / 7; /* temp index */
int nr = index % 7; /* attribute index */
@@ -944,7 +944,7 @@ SENSOR_TEMPLATE(pwm, "pwm%d", S_IRUGO, show_pwm, store_pwm, 0);
static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
int pwm = index; /* pwm index */
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/hwmon/nct6683: Use kobj_to_dev() instead
2020-06-13 8:06 [PATCH] drivers/hwmon/nct6683: Use kobj_to_dev() instead Wang Qing
@ 2020-06-14 21:44 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-06-14 21:44 UTC (permalink / raw)
To: Wang Qing; +Cc: Jean Delvare, linux-hwmon, linux-kernel
On Sat, Jun 13, 2020 at 04:06:44PM +0800, Wang Qing wrote:
> Use kobj_to_dev() instead of container_of()
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
Applied. For future patches, I would suggest to look up subject labels
used in affected subsystems.
Thanks,
Guenter
> ---
> drivers/hwmon/nct6683.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> mode change 100644 => 100755 drivers/hwmon/nct6683.c
>
> diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
> index c022915..2d29914
> --- a/drivers/hwmon/nct6683.c
> +++ b/drivers/hwmon/nct6683.c
> @@ -674,7 +674,7 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
> static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
> int nr = index % 4; /* attribute */
>
> @@ -739,7 +739,7 @@ show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf)
> static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
> int fan = index / 3; /* fan index */
> int nr = index % 3; /* attribute index */
> @@ -857,7 +857,7 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
> static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
> int temp = index / 7; /* temp index */
> int nr = index % 7; /* attribute index */
> @@ -944,7 +944,7 @@ SENSOR_TEMPLATE(pwm, "pwm%d", S_IRUGO, show_pwm, store_pwm, 0);
> static umode_t nct6683_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 nct6683_data *data = dev_get_drvdata(dev);
> int pwm = index; /* pwm index */
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-14 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 8:06 [PATCH] drivers/hwmon/nct6683: Use kobj_to_dev() instead Wang Qing
2020-06-14 21:44 ` 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).