linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (aspeed-pwm-tacho): Switch to using the new API kobj_to_dev()
@ 2021-01-04  2:05 Tian Tao
  2021-01-04  2:12 ` Joel Stanley
  2021-01-08 15:35 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Tian Tao @ 2021-01-04  2:05 UTC (permalink / raw)
  To: jdelvare, linux, joel, andrew, p.zabel
  Cc: linux-hwmon, linux-arm-kernel, linux-aspeed

fixed the following coccicheck:
drivers/hwmon/aspeed-pwm-tacho.c:634:60-61: WARNING opportunity for
kobj_to_dev()
drivers/hwmon/aspeed-pwm-tacho.c:623:60-61: WARNING opportunity for
kobj_to_dev()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/hwmon/aspeed-pwm-tacho.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c
index 3d8239f..3cb88d6 100644
--- a/drivers/hwmon/aspeed-pwm-tacho.c
+++ b/drivers/hwmon/aspeed-pwm-tacho.c
@@ -620,7 +620,7 @@ static ssize_t rpm_show(struct device *dev, struct device_attribute *attr,
 static umode_t pwm_is_visible(struct kobject *kobj,
 			      struct attribute *a, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct aspeed_pwm_tacho_data *priv = dev_get_drvdata(dev);
 
 	if (!priv->pwm_present[index])
@@ -631,7 +631,7 @@ static umode_t pwm_is_visible(struct kobject *kobj,
 static umode_t fan_dev_is_visible(struct kobject *kobj,
 				  struct attribute *a, int index)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct aspeed_pwm_tacho_data *priv = dev_get_drvdata(dev);
 
 	if (!priv->fan_tach_present[index])
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (aspeed-pwm-tacho): Switch to using the new API kobj_to_dev()
  2021-01-04  2:05 [PATCH] hwmon: (aspeed-pwm-tacho): Switch to using the new API kobj_to_dev() Tian Tao
@ 2021-01-04  2:12 ` Joel Stanley
  2021-01-08 15:35 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Joel Stanley @ 2021-01-04  2:12 UTC (permalink / raw)
  To: Tian Tao
  Cc: Jean Delvare, Guenter Roeck, Andrew Jeffery, Philipp Zabel,
	linux-hwmon, Linux ARM, linux-aspeed

On Mon, 4 Jan 2021 at 02:05, Tian Tao <tiantao6@hisilicon.com> wrote:
>
> fixed the following coccicheck:
> drivers/hwmon/aspeed-pwm-tacho.c:634:60-61: WARNING opportunity for
> kobj_to_dev()
> drivers/hwmon/aspeed-pwm-tacho.c:623:60-61: WARNING opportunity for
> kobj_to_dev()
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

Acked-by: Joel Stanley <joel@jms.id.au>

> ---
>  drivers/hwmon/aspeed-pwm-tacho.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c
> index 3d8239f..3cb88d6 100644
> --- a/drivers/hwmon/aspeed-pwm-tacho.c
> +++ b/drivers/hwmon/aspeed-pwm-tacho.c
> @@ -620,7 +620,7 @@ static ssize_t rpm_show(struct device *dev, struct device_attribute *attr,
>  static umode_t pwm_is_visible(struct kobject *kobj,
>                               struct attribute *a, int index)
>  {
> -       struct device *dev = container_of(kobj, struct device, kobj);
> +       struct device *dev = kobj_to_dev(kobj);
>         struct aspeed_pwm_tacho_data *priv = dev_get_drvdata(dev);
>
>         if (!priv->pwm_present[index])
> @@ -631,7 +631,7 @@ static umode_t pwm_is_visible(struct kobject *kobj,
>  static umode_t fan_dev_is_visible(struct kobject *kobj,
>                                   struct attribute *a, int index)
>  {
> -       struct device *dev = container_of(kobj, struct device, kobj);
> +       struct device *dev = kobj_to_dev(kobj);
>         struct aspeed_pwm_tacho_data *priv = dev_get_drvdata(dev);
>
>         if (!priv->fan_tach_present[index])
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (aspeed-pwm-tacho): Switch to using the new API kobj_to_dev()
  2021-01-04  2:05 [PATCH] hwmon: (aspeed-pwm-tacho): Switch to using the new API kobj_to_dev() Tian Tao
  2021-01-04  2:12 ` Joel Stanley
@ 2021-01-08 15:35 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-01-08 15:35 UTC (permalink / raw)
  To: Tian Tao
  Cc: jdelvare, joel, andrew, p.zabel, linux-hwmon, linux-arm-kernel,
	linux-aspeed

On Mon, Jan 04, 2021 at 10:05:45AM +0800, Tian Tao wrote:
> fixed the following coccicheck:
> drivers/hwmon/aspeed-pwm-tacho.c:634:60-61: WARNING opportunity for
> kobj_to_dev()
> drivers/hwmon/aspeed-pwm-tacho.c:623:60-61: WARNING opportunity for
> kobj_to_dev()
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Acked-by: Joel Stanley <joel@jms.id.au>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-08 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04  2:05 [PATCH] hwmon: (aspeed-pwm-tacho): Switch to using the new API kobj_to_dev() Tian Tao
2021-01-04  2:12 ` Joel Stanley
2021-01-08 15:35 ` 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).