thermal.c (1ee14820fd8ee79c4fc191155f48c985f28040e2) | thermal.c (7f4957be0d5b83c8964491863202136c916107ae) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $) 4 * 5 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> 6 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 7 * 8 * This driver fully implements the ACPI thermal policy as described in the --- 485 unchanged lines hidden (view full) --- 494 } 495 return 0; 496} 497 498static void acpi_thermal_check(void *data) 499{ 500 struct acpi_thermal *tz = data; 501 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $) 4 * 5 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> 6 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 7 * 8 * This driver fully implements the ACPI thermal policy as described in the --- 485 unchanged lines hidden (view full) --- 494 } 495 return 0; 496} 497 498static void acpi_thermal_check(void *data) 499{ 500 struct acpi_thermal *tz = data; 501 |
502 if (tz->thermal_zone->mode != THERMAL_DEVICE_ENABLED) | 502 if (!thermal_zone_device_is_enabled(tz->thermal_zone)) |
503 return; 504 505 thermal_zone_device_update(tz->thermal_zone, 506 THERMAL_EVENT_UNSPECIFIED); 507} 508 509/* sys I/F for generic thermal sysfs support */ 510 --- 26 unchanged lines hidden (view full) --- 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 | 503 return; 504 505 thermal_zone_device_update(tz->thermal_zone, 506 THERMAL_EVENT_UNSPECIFIED); 507} 508 509/* sys I/F for generic thermal sysfs support */ 510 --- 26 unchanged lines hidden (view full) --- 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 if (mode != tz->thermal_zone->mode) { 546 tz->thermal_zone->mode = mode; 547 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 548 "%s kernel ACPI thermal control\n", 549 tz->thermal_zone->mode == THERMAL_DEVICE_ENABLED ? 550 "Enable" : "Disable")); 551 acpi_thermal_check(tz); 552 } | 545 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 546 "%s kernel ACPI thermal control\n", 547 mode == THERMAL_DEVICE_ENABLED ? 548 "Enable" : "Disable")); 549 |
553 return 0; 554} 555 556static int thermal_get_trip_type(struct thermal_zone_device *thermal, 557 int trip, enum thermal_trip_type *type) 558{ 559 struct acpi_thermal *tz = thermal->devdata; 560 int i; --- 331 unchanged lines hidden (view full) --- 892 893 status = acpi_bus_attach_private_data(tz->device->handle, 894 tz->thermal_zone); 895 if (ACPI_FAILURE(status)) { 896 result = -ENODEV; 897 goto remove_dev_link; 898 } 899 | 550 return 0; 551} 552 553static int thermal_get_trip_type(struct thermal_zone_device *thermal, 554 int trip, enum thermal_trip_type *type) 555{ 556 struct acpi_thermal *tz = thermal->devdata; 557 int i; --- 331 unchanged lines hidden (view full) --- 889 890 status = acpi_bus_attach_private_data(tz->device->handle, 891 tz->thermal_zone); 892 if (ACPI_FAILURE(status)) { 893 result = -ENODEV; 894 goto remove_dev_link; 895 } 896 |
900 tz->thermal_zone->mode = THERMAL_DEVICE_ENABLED; | 897 result = thermal_zone_device_enable(tz->thermal_zone); 898 if (result) 899 goto acpi_bus_detach; |
901 902 dev_info(&tz->device->dev, "registered as thermal_zone%d\n", 903 tz->thermal_zone->id); 904 905 return 0; 906 | 900 901 dev_info(&tz->device->dev, "registered as thermal_zone%d\n", 902 tz->thermal_zone->id); 903 904 return 0; 905 |
906acpi_bus_detach: 907 acpi_bus_detach_private_data(tz->device->handle); |
|
907remove_dev_link: 908 sysfs_remove_link(&tz->thermal_zone->device.kobj, "device"); 909remove_tz_link: 910 sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone"); 911unregister_tzd: 912 thermal_zone_device_unregister(tz->thermal_zone); 913 914 return result; --- 349 unchanged lines hidden --- | 908remove_dev_link: 909 sysfs_remove_link(&tz->thermal_zone->device.kobj, "device"); 910remove_tz_link: 911 sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone"); 912unregister_tzd: 913 thermal_zone_device_unregister(tz->thermal_zone); 914 915 return result; --- 349 unchanged lines hidden --- |