* [PATCH] thermal: rcar_gen3_thermal: Register hwmon sysfs interface
@ 2019-02-11 19:56 marek.vasut
2019-02-21 8:49 ` Wolfram Sang
0 siblings, 1 reply; 3+ messages in thread
From: marek.vasut @ 2019-02-11 19:56 UTC (permalink / raw)
To: linux-pm; +Cc: Marek Vasut, Eduardo Valentin, Wolfram Sang, linux-renesas-soc
From: Marek Vasut <marek.vasut+renesas@gmail.com>
Register the hwmon sysfs interface on R-Car Gen3 thermal driver to
align it with Gen2 driver. Use devm_add_action() to unregister the
hwmon interface automatically.
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
To: linux-pm@vger.kernel.org
From: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
---
drivers/thermal/rcar_gen3_thermal.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index 75786cc8e2f9..88fa41cf16e8 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -19,6 +19,7 @@
#include <linux/thermal.h>
#include "thermal_core.h"
+#include "thermal_hwmon.h"
/* Register offsets */
#define REG_GEN3_IRQSTR 0x04
@@ -337,6 +338,13 @@ static int rcar_gen3_thermal_remove(struct platform_device *pdev)
return 0;
}
+static void rcar_gen3_hwmon_action(void *data)
+{
+ struct thermal_zone_device *zone = data;
+
+ thermal_remove_hwmon_sysfs(zone);
+}
+
static int rcar_gen3_thermal_probe(struct platform_device *pdev)
{
struct rcar_gen3_thermal_priv *priv;
@@ -429,6 +437,17 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
if (ret < 0)
goto error_unregister;
+ tsc->zone->tzp->no_hwmon = false;
+ ret = thermal_add_hwmon_sysfs(tsc->zone);
+ if (ret)
+ goto error_unregister;
+
+ ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
+ if (ret) {
+ rcar_gen3_hwmon_action(zone);
+ goto error_unregister;
+ }
+
dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret);
}
--
2.19.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] thermal: rcar_gen3_thermal: Register hwmon sysfs interface
2019-02-11 19:56 [PATCH] thermal: rcar_gen3_thermal: Register hwmon sysfs interface marek.vasut
@ 2019-02-21 8:49 ` Wolfram Sang
2019-02-21 9:14 ` Marek Vasut
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2019-02-21 8:49 UTC (permalink / raw)
To: marek.vasut
Cc: linux-pm, Marek Vasut, Eduardo Valentin, Wolfram Sang, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]
> +static void rcar_gen3_hwmon_action(void *data)
> +{
> + struct thermal_zone_device *zone = data;
> +
> + thermal_remove_hwmon_sysfs(zone);
> +}
> +
> static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> {
> struct rcar_gen3_thermal_priv *priv;
> @@ -429,6 +437,17 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> if (ret < 0)
> goto error_unregister;
>
> + tsc->zone->tzp->no_hwmon = false;
> + ret = thermal_add_hwmon_sysfs(tsc->zone);
> + if (ret)
> + goto error_unregister;
> +
> + ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
> + if (ret) {
> + rcar_gen3_hwmon_action(zone);
> + goto error_unregister;
> + }
> +
> dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret);
> }
This slipped through the cracks for me, I am sorry about that. I know it
is applied by now but I still wonder if the above functionality couldn't
be moved into the core as a generic helper? There is nothing R-Car
specific in here. From what I see it could be something like:
devm_thermal_activate_hwmon_sysfs(dev, zone);
?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] thermal: rcar_gen3_thermal: Register hwmon sysfs interface
2019-02-21 8:49 ` Wolfram Sang
@ 2019-02-21 9:14 ` Marek Vasut
0 siblings, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2019-02-21 9:14 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-pm, Marek Vasut, Eduardo Valentin, Wolfram Sang, linux-renesas-soc
On 2/21/19 9:49 AM, Wolfram Sang wrote:
>
>> +static void rcar_gen3_hwmon_action(void *data)
>> +{
>> + struct thermal_zone_device *zone = data;
>> +
>> + thermal_remove_hwmon_sysfs(zone);
>> +}
>> +
>> static int rcar_gen3_thermal_probe(struct platform_device *pdev)
>> {
>> struct rcar_gen3_thermal_priv *priv;
>> @@ -429,6 +437,17 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
>> if (ret < 0)
>> goto error_unregister;
>>
>> + tsc->zone->tzp->no_hwmon = false;
>> + ret = thermal_add_hwmon_sysfs(tsc->zone);
>> + if (ret)
>> + goto error_unregister;
>> +
>> + ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
>> + if (ret) {
>> + rcar_gen3_hwmon_action(zone);
>> + goto error_unregister;
>> + }
>> +
>> dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret);
>> }
>
> This slipped through the cracks for me, I am sorry about that. I know it
> is applied by now but I still wonder if the above functionality couldn't
> be moved into the core as a generic helper? There is nothing R-Car
> specific in here. From what I see it could be something like:
>
> devm_thermal_activate_hwmon_sysfs(dev, zone);
>
> ?
Do you want to grow function name for each parameter to be changed ?
I don't think that scales. However, I don't have any better idea how to
deal with the hwmon thus far.
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-21 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 19:56 [PATCH] thermal: rcar_gen3_thermal: Register hwmon sysfs interface marek.vasut
2019-02-21 8:49 ` Wolfram Sang
2019-02-21 9:14 ` Marek Vasut
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).