History

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.

Andrzej Pietrasiewicz committed 6 years ago

Commit 5d7bd8a1 parent b56bdff6 files · +0 −87Browse files

Unified · Split

6 files
  1. drivers/acpi/thermal.c +0 −26
  2. drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 −30
  3. drivers/platform/x86/acerhdf.c +0 −3
  4. drivers/thermal/imx_thermal.c +0 −6
  5. drivers/thermal/intel/int340x_thermal/int3400_thermal.c +0 −4
  6. drivers/thermal/thermal_of.c +0 −18
drivers/acpi/thermal.c+0−26
@@ -525,31 +525,6 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) · 524 unmodified lines
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 = { · 280 unmodified lines
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+0−30
@@ -275,19 +275,6 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, · 274 unmodified lines
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, · 93 unmodified lines
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, · 51 unmodified lines
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, · 109 unmodified lines
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, · 31 unmodified lines
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+0−3
@@ -397,8 +397,6 @@ static inline void acerhdf_revert_to_bios_mode(void) · 396 unmodified lines
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 }
@@ -406,7 +404,6 @@ static inline void acerhdf_enable_kernelmode(void) · 1 unmodified line
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+0−6
@@ -338,9 +338,6 @@ static int imx_set_mode(struct thermal_zone_device *tz, · 337 unmodified lines
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, · 9 unmodified lines
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+0−4
@@ -386,10 +386,6 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal, · 385 unmodified lines
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+0−18
@@ -267,22 +267,6 @@ static int of_thermal_unbind(struct thermal_zone_device *thermal, · 266 unmodified lines
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, · 85 unmodified lines
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,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t