Skip to content

Commit

Permalink
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/evalenti/linux-soc-thermal

Pull thermal fixes from Eduardo Valentin:
 "Specifics:
   - a few code fixes improving the Exynos code base.  They remove dead
     and unreachable code.  No functional changes here
   - in Exynos code base, fixes regarding the right usage of features
     (TRIMINFO and TRIMRELOAD)
   - documentation of RCAR thermal
   - fix in the of-thermal, regarding the proper usage of of-APIs
   - fixes on thermal-core, removal of unreachable code"

[ Eduardo is sending the thermal fixes on behalf of Rui Zhang this time.
  Rui is currently unable to send pull requests due to troubles with his
  machine and he's currently in a business trip ]

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
  Thermal:Remove usless if(!result) before return tz
  thermal: exynos: fix IRQ clearing on TMU initialization
  thermal: fix multiple disbalanced device node counters
  thermal: rcar: Add binding docs for new R-Car Gen2 SoCs
  thermal: exynos: Add support for TRIM_RELOAD feature at Exynos3250
  thermal: exynos: Add support for many TRIMINFO_CTRL registers
  thermal: samsung: Exynos5260 and Exynos5420 should not use TRIM_RELOAD flag
  thermal: exynos: remove identical values from exynos*_tmu_registers structures
  thermal: exynos: remove redundant pdata checks from exynos_tmu_control()
  thermal: exynos: cache non_hw_trigger_levels in pdata
  thermal: exynos: simplify temp_to_code() and code_to_temp()
  thermal: exynos: remove redundant threshold_code checks from exynos_tmu_initialize()
  thermal: exynos: remove redundant pdata checks from exynos_tmu_initialize()
  thermal: exynos: remove dead code for HW_MODE calibration
  thermal: exynos: remove unused struct exynos_tmu_registers entries
  • Loading branch information
Linus Torvalds committed Nov 4, 2014
2 parents 9319bc1 + 1401586 commit a1cff6e
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 334 deletions.
5 changes: 4 additions & 1 deletion Documentation/devicetree/bindings/thermal/rcar-thermal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Required properties:
- "renesas,thermal-r8a73a4" (R-Mobile AP6)
- "renesas,thermal-r8a7779" (R-Car H1)
- "renesas,thermal-r8a7790" (R-Car H2)
- "renesas,thermal-r8a7791" (R-Car M2)
- "renesas,thermal-r8a7791" (R-Car M2-W)
- "renesas,thermal-r8a7792" (R-Car V2H)
- "renesas,thermal-r8a7793" (R-Car M2-N)
- "renesas,thermal-r8a7794" (R-Car E2)
- reg : Address range of the thermal registers.
The 1st reg will be recognized as common register
if it has "interrupts".
Expand Down
40 changes: 32 additions & 8 deletions drivers/thermal/of-thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,18 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
int (*get_trend)(void *, long *))
{
struct device_node *np, *child, *sensor_np;
struct thermal_zone_device *tzd = ERR_PTR(-ENODEV);

np = of_find_node_by_name(NULL, "thermal-zones");
if (!np)
return ERR_PTR(-ENODEV);

if (!dev || !dev->of_node)
if (!dev || !dev->of_node) {
of_node_put(np);
return ERR_PTR(-EINVAL);
}

sensor_np = dev->of_node;
sensor_np = of_node_get(dev->of_node);

for_each_child_of_node(np, child) {
struct of_phandle_args sensor_specs;
Expand All @@ -422,16 +425,21 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
}

if (sensor_specs.np == sensor_np && id == sensor_id) {
of_node_put(np);
return thermal_zone_of_add_sensor(child, sensor_np,
data,
get_temp,
get_trend);
tzd = thermal_zone_of_add_sensor(child, sensor_np,
data,
get_temp,
get_trend);
of_node_put(sensor_specs.np);
of_node_put(child);
goto exit;
}
of_node_put(sensor_specs.np);
}
exit:
of_node_put(sensor_np);
of_node_put(np);

return ERR_PTR(-ENODEV);
return tzd;
}
EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register);

Expand Down Expand Up @@ -623,6 +631,7 @@ static int thermal_of_populate_trip(struct device_node *np,

/* Required for cooling map matching */
trip->np = np;
of_node_get(np);

return 0;
}
Expand Down Expand Up @@ -730,9 +739,14 @@ thermal_of_build_thermal_zone(struct device_node *np)
return tz;

free_tbps:
for (i = 0; i < tz->num_tbps; i++)
of_node_put(tz->tbps[i].cooling_device);
kfree(tz->tbps);
free_trips:
for (i = 0; i < tz->ntrips; i++)
of_node_put(tz->trips[i].np);
kfree(tz->trips);
of_node_put(gchild);
free_tz:
kfree(tz);
of_node_put(child);
Expand All @@ -742,7 +756,13 @@ thermal_of_build_thermal_zone(struct device_node *np)

static inline void of_thermal_free_zone(struct __thermal_zone *tz)
{
int i;

for (i = 0; i < tz->num_tbps; i++)
of_node_put(tz->tbps[i].cooling_device);
kfree(tz->tbps);
for (i = 0; i < tz->ntrips; i++)
of_node_put(tz->trips[i].np);
kfree(tz->trips);
kfree(tz);
}
Expand Down Expand Up @@ -814,10 +834,13 @@ int __init of_parse_thermal_zones(void)
/* attempting to build remaining zones still */
}
}
of_node_put(np);

return 0;

exit_free:
of_node_put(child);
of_node_put(np);
of_thermal_free_zone(tz);

/* no memory available, so free what we have built */
Expand Down Expand Up @@ -859,4 +882,5 @@ void of_thermal_destroy_zones(void)
kfree(zone->ops);
of_thermal_free_zone(zone->devdata);
}
of_node_put(np);
}
2 changes: 1 addition & 1 deletion drivers/thermal/samsung/exynos_thermal_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define SENSOR_NAME_LEN 16
#define MAX_TRIP_COUNT 8
#define MAX_COOLING_DEVICE 4
#define MAX_THRESHOLD_LEVS 5
#define MAX_TRIMINFO_CTRL_REG 2

#define ACTIVE_INTERVAL 500
#define IDLE_INTERVAL 10000
Expand Down
Loading

0 comments on commit a1cff6e

Please sign in to comment.