Skip to content

Commit 5d7bd8a

Browse files
andrzejtpdlezcano
authored andcommitted
thermal: Simplify or eliminate unnecessary set_mode() methods
Setting polling_delay is now done at thermal_core level (by not polling DISABLED devices), so no need to repeat this code. int340x: Checking for an impossible enum value is unnecessary. acpi/thermal: It only prints debug messages. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> [for acerhdf] Acked-by: Peter Kaestle <[email protected]> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]> Reviewed-by: Amit Kucheria <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b56bdff commit 5d7bd8a

File tree

6 files changed

+0
-87
lines changed

6 files changed

+0
-87
lines changed

drivers/acpi/thermal.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -525,31 +525,6 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
525525
return 0;
526526
}
527527

528-
static int thermal_set_mode(struct thermal_zone_device *thermal,
529-
enum thermal_device_mode mode)
530-
{
531-
struct acpi_thermal *tz = thermal->devdata;
532-
533-
if (!tz)
534-
return -EINVAL;
535-
536-
if (mode != THERMAL_DEVICE_DISABLED &&
537-
mode != THERMAL_DEVICE_ENABLED)
538-
return -EINVAL;
539-
/*
540-
* enable/disable thermal management from ACPI thermal driver
541-
*/
542-
if (mode == THERMAL_DEVICE_DISABLED)
543-
pr_warn("thermal zone will be disabled\n");
544-
545-
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
546-
"%s kernel ACPI thermal control\n",
547-
mode == THERMAL_DEVICE_ENABLED ?
548-
"Enable" : "Disable"));
549-
550-
return 0;
551-
}
552-
553528
static int thermal_get_trip_type(struct thermal_zone_device *thermal,
554529
int trip, enum thermal_trip_type *type)
555530
{
@@ -836,7 +811,6 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
836811
.bind = acpi_thermal_bind_cooling_device,
837812
.unbind = acpi_thermal_unbind_cooling_device,
838813
.get_temp = thermal_get_temp,
839-
.set_mode = thermal_set_mode,
840814
.get_trip_type = thermal_get_trip_type,
841815
.get_trip_temp = thermal_get_trip_temp,
842816
.get_crit_temp = thermal_get_crit_temp,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,6 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
275275
return 0;
276276
}
277277

278-
static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev,
279-
enum thermal_device_mode mode)
280-
{
281-
struct mlxsw_thermal *thermal = tzdev->devdata;
282-
283-
if (mode == THERMAL_DEVICE_ENABLED)
284-
tzdev->polling_delay = thermal->polling_delay;
285-
else
286-
tzdev->polling_delay = 0;
287-
288-
return 0;
289-
}
290-
291278
static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
292279
int *p_temp)
293280
{
@@ -387,7 +374,6 @@ static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,
387374
static struct thermal_zone_device_ops mlxsw_thermal_ops = {
388375
.bind = mlxsw_thermal_bind,
389376
.unbind = mlxsw_thermal_unbind,
390-
.set_mode = mlxsw_thermal_set_mode,
391377
.get_temp = mlxsw_thermal_get_temp,
392378
.get_trip_type = mlxsw_thermal_get_trip_type,
393379
.get_trip_temp = mlxsw_thermal_get_trip_temp,
@@ -445,20 +431,6 @@ static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev,
445431
return err;
446432
}
447433

448-
static int mlxsw_thermal_module_mode_set(struct thermal_zone_device *tzdev,
449-
enum thermal_device_mode mode)
450-
{
451-
struct mlxsw_thermal_module *tz = tzdev->devdata;
452-
struct mlxsw_thermal *thermal = tz->parent;
453-
454-
if (mode == THERMAL_DEVICE_ENABLED)
455-
tzdev->polling_delay = thermal->polling_delay;
456-
else
457-
tzdev->polling_delay = 0;
458-
459-
return 0;
460-
}
461-
462434
static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
463435
int *p_temp)
464436
{
@@ -574,7 +546,6 @@ static int mlxsw_thermal_module_trend_get(struct thermal_zone_device *tzdev,
574546
static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
575547
.bind = mlxsw_thermal_module_bind,
576548
.unbind = mlxsw_thermal_module_unbind,
577-
.set_mode = mlxsw_thermal_module_mode_set,
578549
.get_temp = mlxsw_thermal_module_temp_get,
579550
.get_trip_type = mlxsw_thermal_module_trip_type_get,
580551
.get_trip_temp = mlxsw_thermal_module_trip_temp_get,
@@ -612,7 +583,6 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
612583
static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
613584
.bind = mlxsw_thermal_module_bind,
614585
.unbind = mlxsw_thermal_module_unbind,
615-
.set_mode = mlxsw_thermal_module_mode_set,
616586
.get_temp = mlxsw_thermal_gearbox_temp_get,
617587
.get_trip_type = mlxsw_thermal_module_trip_type_get,
618588
.get_trip_temp = mlxsw_thermal_module_trip_temp_get,

drivers/platform/x86/acerhdf.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,13 @@ static inline void acerhdf_revert_to_bios_mode(void)
397397
{
398398
acerhdf_change_fanstate(ACERHDF_FAN_AUTO);
399399
kernelmode = 0;
400-
if (thz_dev)
401-
thz_dev->polling_delay = 0;
402400

403401
pr_notice("kernel mode fan control OFF\n");
404402
}
405403
static inline void acerhdf_enable_kernelmode(void)
406404
{
407405
kernelmode = 1;
408406

409-
thz_dev->polling_delay = interval*1000;
410407
pr_notice("kernel mode fan control ON\n");
411408
}
412409

drivers/thermal/imx_thermal.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,6 @@ static int imx_set_mode(struct thermal_zone_device *tz,
338338
const struct thermal_soc_data *soc_data = data->socdata;
339339

340340
if (mode == THERMAL_DEVICE_ENABLED) {
341-
tz->polling_delay = IMX_POLLING_DELAY;
342-
tz->passive_delay = IMX_PASSIVE_DELAY;
343-
344341
regmap_write(map, soc_data->sensor_ctrl + REG_CLR,
345342
soc_data->power_down_mask);
346343
regmap_write(map, soc_data->sensor_ctrl + REG_SET,
@@ -356,9 +353,6 @@ static int imx_set_mode(struct thermal_zone_device *tz,
356353
regmap_write(map, soc_data->sensor_ctrl + REG_SET,
357354
soc_data->power_down_mask);
358355

359-
tz->polling_delay = 0;
360-
tz->passive_delay = 0;
361-
362356
if (data->irq_enabled) {
363357
disable_irq(data->irq);
364358
data->irq_enabled = false;

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,6 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal,
386386
if (!priv)
387387
return -EINVAL;
388388

389-
if (mode != THERMAL_DEVICE_ENABLED &&
390-
mode != THERMAL_DEVICE_DISABLED)
391-
return -EINVAL;
392-
393389
if (mode != thermal->mode)
394390
result = int3400_thermal_run_osc(priv->adev->handle,
395391
priv->current_uuid_index,

drivers/thermal/thermal_of.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -267,22 +267,6 @@ static int of_thermal_unbind(struct thermal_zone_device *thermal,
267267
return 0;
268268
}
269269

270-
static int of_thermal_set_mode(struct thermal_zone_device *tz,
271-
enum thermal_device_mode mode)
272-
{
273-
struct __thermal_zone *data = tz->devdata;
274-
275-
if (mode == THERMAL_DEVICE_ENABLED) {
276-
tz->polling_delay = data->polling_delay;
277-
tz->passive_delay = data->passive_delay;
278-
} else {
279-
tz->polling_delay = 0;
280-
tz->passive_delay = 0;
281-
}
282-
283-
return 0;
284-
}
285-
286270
static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip,
287271
enum thermal_trip_type *type)
288272
{
@@ -374,8 +358,6 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
374358
}
375359

376360
static struct thermal_zone_device_ops of_thermal_ops = {
377-
.set_mode = of_thermal_set_mode,
378-
379361
.get_trip_type = of_thermal_get_trip_type,
380362
.get_trip_temp = of_thermal_get_trip_temp,
381363
.set_trip_temp = of_thermal_set_trip_temp,

0 commit comments

Comments
 (0)