linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (abx500): Switch to using the new API kobj_to_dev()
@ 2020-11-26  2:21 Tian Tao
  2020-11-27 15:40 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2020-11-26  2:21 UTC (permalink / raw)
  To: jdelvare, linux; +Cc: linux-hwmon, linux-kernel

fixed the following coccicheck:
drivers/hwmon/abx500.c:266:60-61: WARNING opportunity for kobj_to_dev().

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

diff --git a/drivers/hwmon/abx500.c b/drivers/hwmon/abx500.c
index 50e67cd..4b96488 100644
--- a/drivers/hwmon/abx500.c
+++ b/drivers/hwmon/abx500.c
@@ -263,7 +263,7 @@ static ssize_t max_alarm_show(struct device *dev,
 static umode_t abx500_attrs_visible(struct kobject *kobj,
 				   struct attribute *attr, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct abx500_temp *data = dev_get_drvdata(dev);
 
 	if (data->ops.is_visible)
-- 
2.7.4


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

* Re: [PATCH] hwmon: (abx500): Switch to using the new API kobj_to_dev()
  2020-11-26  2:21 [PATCH] hwmon: (abx500): Switch to using the new API kobj_to_dev() Tian Tao
@ 2020-11-27 15:40 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-11-27 15:40 UTC (permalink / raw)
  To: Tian Tao; +Cc: jdelvare, linux-hwmon, linux-kernel

On Thu, Nov 26, 2020 at 10:21:20AM +0800, Tian Tao wrote:
> fixed the following coccicheck:
> drivers/hwmon/abx500.c:266:60-61: WARNING opportunity for kobj_to_dev().
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/abx500.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/abx500.c b/drivers/hwmon/abx500.c
> index 50e67cd..4b96488 100644
> --- a/drivers/hwmon/abx500.c
> +++ b/drivers/hwmon/abx500.c
> @@ -263,7 +263,7 @@ static ssize_t max_alarm_show(struct device *dev,
>  static umode_t abx500_attrs_visible(struct kobject *kobj,
>  				   struct attribute *attr, int n)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	struct abx500_temp *data = dev_get_drvdata(dev);
>  
>  	if (data->ops.is_visible)

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

end of thread, other threads:[~2020-11-27 15:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  2:21 [PATCH] hwmon: (abx500): Switch to using the new API kobj_to_dev() Tian Tao
2020-11-27 15:40 ` 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).