linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: linux-pm@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Eduardo Valentin <edubezval@gmail.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Zhang Rui <rui.zhang@intel.com>
Subject: [PATCH 3/6] thermal: Register hwmon in thermal_zone_of_sensor_register_param()
Date: Wed, 12 Dec 2018 02:49:24 +0100	[thread overview]
Message-ID: <20181212014927.25840-4-marek.vasut+renesas@gmail.com> (raw)
In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com>

Register hwmon sysfs interface in thermal_zone_of_sensor_register_param()
in case thermal_zone_params->no_hwmon is set to false. This behavior is
the same as thermal_zone_device_register().

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-renesas-soc@vger.kernel.org
To: linux-pm@vger.kernel.org
---
 drivers/thermal/of-thermal.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 901d8799587a..39b2f2105d0b 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -15,6 +15,7 @@
 #include <linux/string.h>
 
 #include "thermal_core.h"
+#include "thermal_hwmon.h"
 
 /***   Private data structures to represent thermal device tree data ***/
 
@@ -521,8 +522,15 @@ thermal_zone_of_sensor_register_params(struct device *dev, int sensor_id,
 		if (sensor_specs.np == sensor_np && id == sensor_id) {
 			tzd = thermal_zone_of_add_sensor(child, sensor_np,
 							 data, ops);
-			if (!IS_ERR(tzd))
+			if (!IS_ERR(tzd)) {
+				tzd->tzp = tzp;
 				tzd->ops->set_mode(tzd, THERMAL_DEVICE_ENABLED);
+				if (!tzp || !tzp->no_hwmon) {
+					ret = thermal_add_hwmon_sysfs(tzd);
+					if (ret)
+						tzd = ERR_PTR(ret);
+				}
+			}
 
 			of_node_put(sensor_specs.np);
 			of_node_put(child);
@@ -604,6 +612,8 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
 
 	tz = tzd->devdata;
 
+	thermal_remove_hwmon_sysfs(tzd);
+
 	/* no __thermal_zone, nothing to be done */
 	if (!tz)
 		return;
-- 
2.18.0


  parent reply	other threads:[~2018-12-12  1:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12  1:49 [PATCH 0/6] thermal: Align devm_thermal_zone_{device,of_sensor}_register Marek Vasut
2018-12-12  1:49 ` [PATCH 1/6] thermal: split thermal_zone_of_sensor_register{,_param}() Marek Vasut
2018-12-15 17:23   ` Eduardo Valentin
2018-12-15 18:38     ` Marek Vasut
2018-12-15 18:47       ` Geert Uytterhoeven
2018-12-15 18:49         ` Marek Vasut
2018-12-15 18:54           ` Geert Uytterhoeven
2018-12-15 19:07             ` Marek Vasut
2018-12-15 20:00               ` Geert Uytterhoeven
2018-12-15 20:13                 ` Marek Vasut
2018-12-16  8:39                   ` Geert Uytterhoeven
2018-12-16 17:25                     ` Marek Vasut
2018-12-16 17:42                       ` Geert Uytterhoeven
2018-12-16 17:48                         ` Marek Vasut
2018-12-16 20:08                           ` Geert Uytterhoeven
2018-12-16 20:43                             ` Marek Vasut
2018-12-17 13:26                               ` Geert Uytterhoeven
2018-12-17 13:28                                 ` Marek Vasut
2018-12-17 13:36                                   ` Geert Uytterhoeven
2018-12-17 13:41                                     ` Marek Vasut
2018-12-17 14:15                                       ` Geert Uytterhoeven
2018-12-17 15:52                                         ` Marek Vasut
2018-12-12  1:49 ` [PATCH 2/6] thermal: split devm_thermal_zone_of_sensor_register{,_param}() Marek Vasut
2018-12-12  1:49 ` Marek Vasut [this message]
2018-12-12  1:49 ` [PATCH 4/6] thermal: stm32: Convert to devm_thermal_zone_of_sensor_register_params() Marek Vasut
2018-12-12  1:49 ` [PATCH 5/6] thermal: rcar_thermal: " Marek Vasut
2018-12-12  1:49 ` [PATCH 6/6] thermal: rcar_gen3_thermal: Register hwmon sysfs interface Marek Vasut
2018-12-14  5:28   ` kbuild test robot
2018-12-15  2:02 ` [PATCH 0/6] thermal: Align devm_thermal_zone_{device,of_sensor}_register Eduardo Valentin
2018-12-15  2:08   ` Marek Vasut
2018-12-15 17:23     ` Eduardo Valentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181212014927.25840-4-marek.vasut+renesas@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=rui.zhang@intel.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).