linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (gpio-fan): Switch to using the new API kobj_to_dev()
@ 2020-12-29  3:17 Tian Tao
  2020-12-30 16:04 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2020-12-29  3:17 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon

fixed the following coccicheck:
drivers/hwmon/gpio-fan.c:302:60-61: WARNING opportunity for
kobj_to_dev()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/hwmon/gpio-fan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index 3ea4021..befe989 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -299,7 +299,7 @@ static DEVICE_ATTR(fan1_target, 0644, fan1_input_show, set_rpm);
 static umode_t gpio_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 gpio_fan_data *data = dev_get_drvdata(dev);
 
 	if (index == 0 && !data->alarm_gpio)
-- 
2.7.4


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

* Re: [PATCH] hwmon: (gpio-fan): Switch to using the new API kobj_to_dev()
  2020-12-29  3:17 [PATCH] hwmon: (gpio-fan): Switch to using the new API kobj_to_dev() Tian Tao
@ 2020-12-30 16:04 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-12-30 16:04 UTC (permalink / raw)
  To: Tian Tao; +Cc: jdelvare, linux-hwmon

On Tue, Dec 29, 2020 at 11:17:17AM +0800, Tian Tao wrote:
> fixed the following coccicheck:
> drivers/hwmon/gpio-fan.c:302:60-61: WARNING opportunity for
> kobj_to_dev()
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/gpio-fan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
> index 3ea4021..befe989 100644
> --- a/drivers/hwmon/gpio-fan.c
> +++ b/drivers/hwmon/gpio-fan.c
> @@ -299,7 +299,7 @@ static DEVICE_ATTR(fan1_target, 0644, fan1_input_show, set_rpm);
>  static umode_t gpio_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 gpio_fan_data *data = dev_get_drvdata(dev);
>  
>  	if (index == 0 && !data->alarm_gpio)

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

end of thread, other threads:[~2020-12-30 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29  3:17 [PATCH] hwmon: (gpio-fan): Switch to using the new API kobj_to_dev() Tian Tao
2020-12-30 16:04 ` 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).