Skip to content

Commit bae1577

Browse files
committed
Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management fixes from Zhang Rui: "Specifics: - fix an error that "weight_attr" sysfs attribute is not removed while unbinding. From: Viresh Kumar. - fix power allocator governor tracing to return the real request. From Javi Merino. - remove redundant owner assignment of hisi platform thermal driver. From Krzysztof Kozlowski. - a couple of small fixes of Exynos thermal driver. From Krzysztof Kozlowski and Chanwoo Choi" * 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: Drop owner assignment from platform_driver thermal: exynos: Remove unused code related to platform_data on probe() thermal: exynos: Add the dependency of CONFIG_THERMAL_OF instead of CONFIG_OF thermal: exynos: Disable the regulator on probe failure thermal: power_allocator: trace the real requested power thermal: remove dangling 'weight_attr' device file
2 parents dd2384a + 8bf93f2 commit bae1577

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

drivers/thermal/hisi_thermal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
405405
static struct platform_driver hisi_thermal_driver = {
406406
.driver = {
407407
.name = "hisi_thermal",
408-
.owner = THIS_MODULE,
409408
.pm = &hisi_thermal_pm_ops,
410409
.of_match_table = of_hisi_thermal_match,
411410
},

drivers/thermal/power_allocator.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ static int allocate_power(struct thermal_zone_device *tz,
229229
struct thermal_instance *instance;
230230
struct power_allocator_params *params = tz->governor_data;
231231
u32 *req_power, *max_power, *granted_power, *extra_actor_power;
232-
u32 total_req_power, max_allocatable_power;
232+
u32 *weighted_req_power;
233+
u32 total_req_power, max_allocatable_power, total_weighted_req_power;
233234
u32 total_granted_power, power_range;
234235
int i, num_actors, total_weight, ret = 0;
235236
int trip_max_desired_temperature = params->trip_max_desired_temperature;
@@ -247,16 +248,17 @@ static int allocate_power(struct thermal_zone_device *tz,
247248
}
248249

249250
/*
250-
* We need to allocate three arrays of the same size:
251-
* req_power, max_power and granted_power. They are going to
252-
* be needed until this function returns. Allocate them all
253-
* in one go to simplify the allocation and deallocation
254-
* logic.
251+
* We need to allocate five arrays of the same size:
252+
* req_power, max_power, granted_power, extra_actor_power and
253+
* weighted_req_power. They are going to be needed until this
254+
* function returns. Allocate them all in one go to simplify
255+
* the allocation and deallocation logic.
255256
*/
256257
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power));
257258
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power));
258259
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power));
259-
req_power = devm_kcalloc(&tz->device, num_actors * 4,
260+
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*weighted_req_power));
261+
req_power = devm_kcalloc(&tz->device, num_actors * 5,
260262
sizeof(*req_power), GFP_KERNEL);
261263
if (!req_power) {
262264
ret = -ENOMEM;
@@ -266,8 +268,10 @@ static int allocate_power(struct thermal_zone_device *tz,
266268
max_power = &req_power[num_actors];
267269
granted_power = &req_power[2 * num_actors];
268270
extra_actor_power = &req_power[3 * num_actors];
271+
weighted_req_power = &req_power[4 * num_actors];
269272

270273
i = 0;
274+
total_weighted_req_power = 0;
271275
total_req_power = 0;
272276
max_allocatable_power = 0;
273277

@@ -289,22 +293,24 @@ static int allocate_power(struct thermal_zone_device *tz,
289293
else
290294
weight = instance->weight;
291295

292-
req_power[i] = frac_to_int(weight * req_power[i]);
296+
weighted_req_power[i] = frac_to_int(weight * req_power[i]);
293297

294298
if (power_actor_get_max_power(cdev, tz, &max_power[i]))
295299
continue;
296300

297301
total_req_power += req_power[i];
298302
max_allocatable_power += max_power[i];
303+
total_weighted_req_power += weighted_req_power[i];
299304

300305
i++;
301306
}
302307

303308
power_range = pid_controller(tz, current_temp, control_temp,
304309
max_allocatable_power);
305310

306-
divvy_up_power(req_power, max_power, num_actors, total_req_power,
307-
power_range, granted_power, extra_actor_power);
311+
divvy_up_power(weighted_req_power, max_power, num_actors,
312+
total_weighted_req_power, power_range, granted_power,
313+
extra_actor_power);
308314

309315
total_granted_power = 0;
310316
i = 0;

drivers/thermal/samsung/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
config EXYNOS_THERMAL
22
tristate "Exynos thermal management unit driver"
3-
depends on OF
3+
depends on THERMAL_OF
44
help
55
If you say yes here you get support for the TMU (Thermal Management
66
Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises

drivers/thermal/samsung/exynos_tmu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,6 @@ static struct thermal_zone_of_device_ops exynos_sensor_ops = {
12961296

12971297
static int exynos_tmu_probe(struct platform_device *pdev)
12981298
{
1299-
struct exynos_tmu_platform_data *pdata;
13001299
struct exynos_tmu_data *data;
13011300
int ret;
13021301

@@ -1318,8 +1317,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
13181317
if (ret)
13191318
goto err_sensor;
13201319

1321-
pdata = data->pdata;
1322-
13231320
INIT_WORK(&data->irq_work, exynos_tmu_work);
13241321

13251322
data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
@@ -1392,6 +1389,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
13921389
if (!IS_ERR(data->clk_sec))
13931390
clk_unprepare(data->clk_sec);
13941391
err_sensor:
1392+
if (!IS_ERR_OR_NULL(data->regulator))
1393+
regulator_disable(data->regulator);
13951394
thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
13961395

13971396
return ret;

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
13331333
return -ENODEV;
13341334

13351335
unbind:
1336+
device_remove_file(&tz->device, &pos->weight_attr);
13361337
device_remove_file(&tz->device, &pos->attr);
13371338
sysfs_remove_link(&tz->device.kobj, pos->name);
13381339
release_idr(&tz->idr, &tz->lock, pos->id);

0 commit comments

Comments
 (0)