diff mbox series

drivers/thermal: Use kobj_to_dev() instead

Message ID 1592212056-31955-1-git-send-email-wangqing@vivo.com
State New
Delegated to: Zhang Rui
Headers show
Series drivers/thermal: Use kobj_to_dev() instead | expand

Commit Message

Wang Qing June 15, 2020, 9:07 a.m. UTC
Use kobj_to_dev() instead of container_of()

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 drivers/thermal/thermal_sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/thermal/thermal_sysfs.c

Comments

Amit Kucheria June 23, 2020, 12:45 p.m. UTC | #1
On Mon, Jun 15, 2020 at 2:37 PM Wang Qing <wangqing@vivo.com> wrote:
>
> Use kobj_to_dev() instead of container_of()
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>

Acked-by: Amit Kucheria <amit.kucheria@linaro.org>

> ---
>  drivers/thermal/thermal_sysfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>  mode change 100644 => 100755 drivers/thermal/thermal_sysfs.c
>
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index aa99edb..3e92ff9
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -438,7 +438,7 @@ static umode_t thermal_zone_mode_is_visible(struct kobject *kobj,
>                                             struct attribute *attr,
>                                             int attrno)
>  {
> -       struct device *dev = container_of(kobj, struct device, kobj);
> +       struct device *dev = kobj_to_dev(kobj);
>         struct thermal_zone_device *tz;
>
>         tz = container_of(dev, struct thermal_zone_device, device);
> @@ -464,7 +464,7 @@ static umode_t thermal_zone_passive_is_visible(struct kobject *kobj,
>                                                struct attribute *attr,
>                                                int attrno)
>  {
> -       struct device *dev = container_of(kobj, struct device, kobj);
> +       struct device *dev = kobj_to_dev(kobj);
>         struct thermal_zone_device *tz;
>         enum thermal_trip_type trip_type;
>         int count, passive = 0;
> --
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index aa99edb..3e92ff9
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -438,7 +438,7 @@  static umode_t thermal_zone_mode_is_visible(struct kobject *kobj,
 					    struct attribute *attr,
 					    int attrno)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct thermal_zone_device *tz;
 
 	tz = container_of(dev, struct thermal_zone_device, device);
@@ -464,7 +464,7 @@  static umode_t thermal_zone_passive_is_visible(struct kobject *kobj,
 					       struct attribute *attr,
 					       int attrno)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct thermal_zone_device *tz;
 	enum thermal_trip_type trip_type;
 	int count, passive = 0;