All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pwm-fan): Switch to using the new API kobj_to_dev()
@ 2020-11-28  1:00 Tian Tao
  2020-11-28 20:23 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2020-11-28  1:00 UTC (permalink / raw)
  To: kamil, b.zolnierkie, jdelvare, linux, thierry.reding,
	u.kleine-koenig, lee.jones, lgirdwood, broonie
  Cc: linux-hwmon, linux-kernel, linux-pwm

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

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

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 1f63807..7849011 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -149,7 +149,7 @@ static struct attribute *pwm_fan_attrs[] = {
 static umode_t pwm_fan_attrs_visible(struct kobject *kobj, struct attribute *a,
 				     int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
 
 	/* Hide fan_input in case no interrupt is available  */
-- 
2.7.4


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

* Re: [PATCH] hwmon: (pwm-fan): Switch to using the new API kobj_to_dev()
  2020-11-28  1:00 [PATCH] hwmon: (pwm-fan): Switch to using the new API kobj_to_dev() Tian Tao
@ 2020-11-28 20:23 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-11-28 20:23 UTC (permalink / raw)
  To: Tian Tao
  Cc: kamil, b.zolnierkie, jdelvare, thierry.reding, u.kleine-koenig,
	lee.jones, lgirdwood, broonie, linux-hwmon, linux-kernel,
	linux-pwm

On Sat, Nov 28, 2020 at 09:00:06AM +0800, Tian Tao wrote:
> fixed the following coccicheck:
> drivers/hwmon//pwm-fan.c:152:60-61: WARNING opportunity for kobj_to_dev().
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

With the switch to use devm_hwmon_device_register_with_info() instead of
devm_hwmon_device_register_with_groups(), this patch is no longer necessary.
Please see tip of hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/pwm-fan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
> index 1f63807..7849011 100644
> --- a/drivers/hwmon/pwm-fan.c
> +++ b/drivers/hwmon/pwm-fan.c
> @@ -149,7 +149,7 @@ static struct attribute *pwm_fan_attrs[] = {
>  static umode_t pwm_fan_attrs_visible(struct kobject *kobj, struct attribute *a,
>  				     int n)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
>  
>  	/* Hide fan_input in case no interrupt is available  */

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

end of thread, other threads:[~2020-11-28 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28  1:00 [PATCH] hwmon: (pwm-fan): Switch to using the new API kobj_to_dev() Tian Tao
2020-11-28 20:23 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.