* [PATCH] hwmon: Switch to using the new API kobj_to_dev()
@ 2021-02-23 9:14 Yang Li
2021-03-11 21:38 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-02-23 9:14 UTC (permalink / raw)
To: jdelvare; +Cc: linux, linux-hwmon, linux-kernel, Yang Li
fixed the following coccicheck:
./drivers/hwmon/hwmon.c:82:60-61: WARNING opportunity for kobj_to_dev()
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/hwmon/hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 6c68405..fd47ab4 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -79,7 +79,7 @@ struct hwmon_thermal_data {
static umode_t hwmon_dev_name_is_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);
if (to_hwmon_device(dev)->name == NULL)
return 0;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: Switch to using the new API kobj_to_dev()
2021-02-23 9:14 [PATCH] hwmon: Switch to using the new API kobj_to_dev() Yang Li
@ 2021-03-11 21:38 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-03-11 21:38 UTC (permalink / raw)
To: Yang Li; +Cc: jdelvare, linux-hwmon, linux-kernel
On Tue, Feb 23, 2021 at 05:14:27PM +0800, Yang Li wrote:
> fixed the following coccicheck:
> ./drivers/hwmon/hwmon.c:82:60-61: WARNING opportunity for kobj_to_dev()
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/hwmon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 6c68405..fd47ab4 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -79,7 +79,7 @@ struct hwmon_thermal_data {
> static umode_t hwmon_dev_name_is_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);
>
> if (to_hwmon_device(dev)->name == NULL)
> return 0;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-11 21:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 9:14 [PATCH] hwmon: Switch to using the new API kobj_to_dev() Yang Li
2021-03-11 21:38 ` 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.