thermal: rcar_gen3_thermal: Register hwmon sysfs interface
Subsystems (2)
PATCH 1/1 thermal: rcar_gen3_thermal: Register hwmon sysfs interface
From: Marek Vasut <[email protected]>
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 <[email protected]>
Cc: Wolfram Sang <[email protected]>
Cc: [email protected]
To: [email protected]
From: Marek Vasut <[email protected]>
--- drivers/thermal/rcar_gen3_thermal.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/thermal/rcar_gen3_thermal.c +19 -0
@@ -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); }
Signature · 1 line
2.19.2
Quoted 18 lines
drivers/thermal/rcar_gen3_thermal.c +10
-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)
drivers/thermal/rcar_gen3_thermal.c static int rcar_gen3_thermal_probe(struct platform_device *pdev) · line 452
Quoted 10 lines
drivers/thermal/rcar_gen3_thermal.c +8
-0+ 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);
?
Quoted 34 lines · Wolfram Sang
Quoted 18 lines
drivers/thermal/rcar_gen3_thermal.c +10
-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)drivers/thermal/rcar_gen3_thermal.c static int rcar_gen3_thermal_probe(struct platform_device *pdev) · line 452
Quoted 10 lines
drivers/thermal/rcar_gen3_thermal.c +8
-0+ 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:
Quoted 3 lines
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.
Signature · 2 lines
Best regards, Marek Vasut