diff mbox series

hwmon: (abx500): Switch to using the new API kobj_to_dev()

Message ID 1606357280-51921-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State Accepted
Headers show
Series hwmon: (abx500): Switch to using the new API kobj_to_dev() | expand

Commit Message

Tian Tao Nov. 26, 2020, 2:21 a.m. UTC
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(-)

Comments

Guenter Roeck Nov. 27, 2020, 3:40 p.m. UTC | #1
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)
diff mbox series

Patch

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)