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.
Unified · Split
| @@ -525,31 +525,6 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) · 524 unmodified lines | |||
| 525 | return 0; | 525 | return 0; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 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 | |||
| 553 | static int thermal_get_trip_type(struct thermal_zone_device *thermal, | 528 | static int thermal_get_trip_type(struct thermal_zone_device *thermal, |
| 554 | int trip, enum thermal_trip_type *type) | 529 | int trip, enum thermal_trip_type *type) |
| 555 | { | 530 | { |
| @@ -836,7 +811,6 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { · 280 unmodified lines | |||
| 836 | .bind = acpi_thermal_bind_cooling_device, | 811 | .bind = acpi_thermal_bind_cooling_device, |
| 837 | .unbind = acpi_thermal_unbind_cooling_device, | 812 | .unbind = acpi_thermal_unbind_cooling_device, |
| 838 | .get_temp = thermal_get_temp, | 813 | .get_temp = thermal_get_temp, |
| 839 | .set_mode = thermal_set_mode, | ||
| 840 | .get_trip_type = thermal_get_trip_type, | 814 | .get_trip_type = thermal_get_trip_type, |
| 841 | .get_trip_temp = thermal_get_trip_temp, | 815 | .get_trip_temp = thermal_get_trip_temp, |
| 842 | .get_crit_temp = thermal_get_crit_temp, | 816 | .get_crit_temp = thermal_get_crit_temp, |
| @@ -275,19 +275,6 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, · 274 unmodified lines | |||
| 275 | return 0; | 275 | return 0; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 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 | |||
| 291 | static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev, | 278 | static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev, |
| 292 | int *p_temp) | 279 | int *p_temp) |
| 293 | { | 280 | { |
| @@ -387,7 +374,6 @@ static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev, · 93 unmodified lines | |||
| 387 | static struct thermal_zone_device_ops mlxsw_thermal_ops = { | 374 | static struct thermal_zone_device_ops mlxsw_thermal_ops = { |
| 388 | .bind = mlxsw_thermal_bind, | 375 | .bind = mlxsw_thermal_bind, |
| 389 | .unbind = mlxsw_thermal_unbind, | 376 | .unbind = mlxsw_thermal_unbind, |
| 390 | .set_mode = mlxsw_thermal_set_mode, | ||
| 391 | .get_temp = mlxsw_thermal_get_temp, | 377 | .get_temp = mlxsw_thermal_get_temp, |
| 392 | .get_trip_type = mlxsw_thermal_get_trip_type, | 378 | .get_trip_type = mlxsw_thermal_get_trip_type, |
| 393 | .get_trip_temp = mlxsw_thermal_get_trip_temp, | 379 | .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 | |||
| 445 | return err; | 431 | return err; |
| 446 | } | 432 | } |
| 447 | 433 | ||
| 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 | |||
| 462 | static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev, | 434 | static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev, |
| 463 | int *p_temp) | 435 | int *p_temp) |
| 464 | { | 436 | { |
| @@ -574,7 +546,6 @@ static int mlxsw_thermal_module_trend_get(struct thermal_zone_device *tzdev, · 109 unmodified lines | |||
| 574 | static struct thermal_zone_device_ops mlxsw_thermal_module_ops = { | 546 | static struct thermal_zone_device_ops mlxsw_thermal_module_ops = { |
| 575 | .bind = mlxsw_thermal_module_bind, | 547 | .bind = mlxsw_thermal_module_bind, |
| 576 | .unbind = mlxsw_thermal_module_unbind, | 548 | .unbind = mlxsw_thermal_module_unbind, |
| 577 | .set_mode = mlxsw_thermal_module_mode_set, | ||
| 578 | .get_temp = mlxsw_thermal_module_temp_get, | 549 | .get_temp = mlxsw_thermal_module_temp_get, |
| 579 | .get_trip_type = mlxsw_thermal_module_trip_type_get, | 550 | .get_trip_type = mlxsw_thermal_module_trip_type_get, |
| 580 | .get_trip_temp = mlxsw_thermal_module_trip_temp_get, | 551 | .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 | |||
| 612 | static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = { | 583 | static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = { |
| 613 | .bind = mlxsw_thermal_module_bind, | 584 | .bind = mlxsw_thermal_module_bind, |
| 614 | .unbind = mlxsw_thermal_module_unbind, | 585 | .unbind = mlxsw_thermal_module_unbind, |
| 615 | .set_mode = mlxsw_thermal_module_mode_set, | ||
| 616 | .get_temp = mlxsw_thermal_gearbox_temp_get, | 586 | .get_temp = mlxsw_thermal_gearbox_temp_get, |
| 617 | .get_trip_type = mlxsw_thermal_module_trip_type_get, | 587 | .get_trip_type = mlxsw_thermal_module_trip_type_get, |
| 618 | .get_trip_temp = mlxsw_thermal_module_trip_temp_get, | 588 | .get_trip_temp = mlxsw_thermal_module_trip_temp_get, |
| @@ -397,8 +397,6 @@ static inline void acerhdf_revert_to_bios_mode(void) · 396 unmodified lines | |||
| 397 | { | 397 | { |
| 398 | acerhdf_change_fanstate(ACERHDF_FAN_AUTO); | 398 | acerhdf_change_fanstate(ACERHDF_FAN_AUTO); |
| 399 | kernelmode = 0; | 399 | kernelmode = 0; |
| 400 | if (thz_dev) | ||
| 401 | thz_dev->polling_delay = 0; | ||
| 402 | 400 | ||
| 403 | pr_notice("kernel mode fan control OFF\n"); | 401 | pr_notice("kernel mode fan control OFF\n"); |
| 404 | } | 402 | } |
| @@ -406,7 +404,6 @@ static inline void acerhdf_enable_kernelmode(void) · 1 unmodified line | |||
| 406 | { | 404 | { |
| 407 | kernelmode = 1; | 405 | kernelmode = 1; |
| 408 | 406 | ||
| 409 | thz_dev->polling_delay = interval*1000; | ||
| 410 | pr_notice("kernel mode fan control ON\n"); | 407 | pr_notice("kernel mode fan control ON\n"); |
| 411 | } | 408 | } |
| 412 | 409 | ||
| @@ -338,9 +338,6 @@ static int imx_set_mode(struct thermal_zone_device *tz, · 337 unmodified lines | |||
| 338 | const struct thermal_soc_data *soc_data = data->socdata; | 338 | const struct thermal_soc_data *soc_data = data->socdata; |
| 339 | 339 | ||
| 340 | if (mode == THERMAL_DEVICE_ENABLED) { | 340 | if (mode == THERMAL_DEVICE_ENABLED) { |
| 341 | tz->polling_delay = IMX_POLLING_DELAY; | ||
| 342 | tz->passive_delay = IMX_PASSIVE_DELAY; | ||
| 343 | |||
| 344 | regmap_write(map, soc_data->sensor_ctrl + REG_CLR, | 341 | regmap_write(map, soc_data->sensor_ctrl + REG_CLR, |
| 345 | soc_data->power_down_mask); | 342 | soc_data->power_down_mask); |
| 346 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, | 343 | 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 | |||
| 356 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, | 353 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, |
| 357 | soc_data->power_down_mask); | 354 | soc_data->power_down_mask); |
| 358 | 355 | ||
| 359 | tz->polling_delay = 0; | ||
| 360 | tz->passive_delay = 0; | ||
| 361 | |||
| 362 | if (data->irq_enabled) { | 356 | if (data->irq_enabled) { |
| 363 | disable_irq(data->irq); | 357 | disable_irq(data->irq); |
| 364 | data->irq_enabled = false; | 358 | data->irq_enabled = false; |
| @@ -386,10 +386,6 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal, · 385 unmodified lines | |||
| 386 | if (!priv) | 386 | if (!priv) |
| 387 | return -EINVAL; | 387 | return -EINVAL; |
| 388 | 388 | ||
| 389 | if (mode != THERMAL_DEVICE_ENABLED && | ||
| 390 | mode != THERMAL_DEVICE_DISABLED) | ||
| 391 | return -EINVAL; | ||
| 392 | |||
| 393 | if (mode != thermal->mode) | 389 | if (mode != thermal->mode) |
| 394 | result = int3400_thermal_run_osc(priv->adev->handle, | 390 | result = int3400_thermal_run_osc(priv->adev->handle, |
| 395 | priv->current_uuid_index, | 391 | priv->current_uuid_index, |
| @@ -267,22 +267,6 @@ static int of_thermal_unbind(struct thermal_zone_device *thermal, · 266 unmodified lines | |||
| 267 | return 0; | 267 | return 0; |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 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 | |||
| 286 | static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, | 270 | static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, |
| 287 | enum thermal_trip_type *type) | 271 | enum thermal_trip_type *type) |
| 288 | { | 272 | { |
| @@ -374,8 +358,6 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, · 85 unmodified lines | |||
| 374 | } | 358 | } |
| 375 | 359 | ||
| 376 | static struct thermal_zone_device_ops of_thermal_ops = { | 360 | static struct thermal_zone_device_ops of_thermal_ops = { |
| 377 | .set_mode = of_thermal_set_mode, | ||
| 378 | |||
| 379 | .get_trip_type = of_thermal_get_trip_type, | 361 | .get_trip_type = of_thermal_get_trip_type, |
| 380 | .get_trip_temp = of_thermal_get_trip_temp, | 362 | .get_trip_temp = of_thermal_get_trip_temp, |
| 381 | .set_trip_temp = of_thermal_set_trip_temp, | 363 | .set_trip_temp = of_thermal_set_trip_temp, |