History

Merge tag 'acpi-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki: "These add Microsoft fan extensions support to the ACPI fan driver, fix a bug in ACPICA, update other ACPI drivers (processor, time and alarm device), update ACPI power management code and ACPI device properties management, and fix an ACPI utility: - Avoid walking the ACPI namespace in the AML interpreter if the starting node cannot be determined (Cryolitia PukNgae) - Use min() instead of min_t() in the ACPI device properties handling code to avoid discarding significant bits (David Laight) - Fix potential fwnode refcount leak in acpi_fwnode_graph_parse_endpoint() that may prevent the parent fwnode from being released (Haotian Zhang) - Rework acpi_graph_get_next_endpoint() to use ACPI functions only, remove unnecessary conditionals from it to make it easier to follow, and make acpi_get_next_subnode() static (Sakari Ailus) - Drop unused function acpi_get_lps0_constraint(), make some Low-Power S0 callback functions for suspend-to-idle static, and rearrange the code retrieving Low-Power S0 constraints so it only runs when the constraints are actually used (Rafael Wysocki) - Drop redundant locking from the ACPI battery driver (Rafael Wysocki) - Improve runtime PM in the ACPI time and alarm device (TAD) driver using guard macros and rearrange code related to runtime PM in acpi_tad_remove() (Rafael Wysocki) - Add support for Microsoft fan extensions to the ACPI fan driver along with notification support and work around a 64-bit firmware bug in that driver (Armin Wolf) - Use ACPI_FREE() to free ACPI buffer in the ACPI DPTF code (Kaushlendra Kumar) - Fix a memory leak and a resource leak in the ACPI pfrut utility (Malaya Kumar Rout) - Replace `core::mem::zeroed` with `pin_init::zeroed` in the ACPI Rust code (Siyuan Huang) - Update the ACPI code to use the new style of allocating workqueues and new global workqueues (Marco Crivellari) - Fix two spelling mistakes in the ACPI code (Chu Guangqing) - Fix ISAPNP to generate uevents to auto-load modules (René Rebe) - Relocate the state flags initialization in the ACPI processor idle driver and drop redundant C-state count checks from it (Huisong Li) - Fix map_x2apic_id() in the ACPI processor core driver for amd-pstate on am4 (René Rebe)" * tag 'acpi-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (30 commits) ACPI: PM: Fix a spelling mistake ACPI: LPSS: Fix a spelling mistake ACPI: processor_core: fix map_x2apic_id for amd-pstate on am4 ACPICA: Avoid walking the Namespace if start_node is NULL ACPI: tools: pfrut: fix memory leak and resource leak in pfrut.c ACPI: property: use min() instead of min_t() PNP: Fix ISAPNP to generate uevents to auto-load modules ACPI: property: Fix fwnode refcount leak in acpi_fwnode_graph_parse_endpoint() ACPI: DPTF: Use ACPI_FREE() for ACPI buffer deallocation ACPI: processor: idle: Drop redundant C-state count checks ACPI: thermal: Add WQ_PERCPU to alloc_workqueue() users ACPI: OSL: Add WQ_PERCPU to alloc_workqueue() users ACPI: EC: Add WQ_PERCPU to alloc_workqueue() users ACPI: OSL: replace use of system_wq with system_percpu_wq ACPI: scan: replace use of system_unbound_wq with system_dfl_wq ACPI: fan: Add support for Microsoft fan extensions ACPI: fan: Add hwmon notification support ACPI: fan: Add basic notification support ACPI: TAD: Improve runtime PM using guard macros ACPI: TAD: Rearrange runtime PM operations in acpi_tad_remove() ...

Linus Torvalds committed 11 months ago

Commit 959bfe42 parents 44fc843 af47d9822 files · +420 −168Browse files

Unified · Split

22 files
  1. drivers/acpi/acpi_tad.c +39 −34
  2. drivers/acpi/acpica/nswalk.c +6 −3
  3. drivers/acpi/battery.c +0 −12
  4. drivers/acpi/dptf/dptf_pch_fivr.c +1 −1
  5. drivers/acpi/ec.c +2 −1
  6. drivers/acpi/fan.h +40 −0
  7. drivers/acpi/fan_core.c +222 −1
  8. drivers/acpi/fan_hwmon.c +14 −11
  9. drivers/acpi/osl.c +3 −3
  10. drivers/acpi/processor_core.c +1 −1
  11. drivers/acpi/processor_idle.c +16 −26
  12. drivers/acpi/property.c +17 −12
  13. drivers/acpi/scan.c +1 −1
  14. drivers/acpi/sleep.c +1 −1
  15. drivers/acpi/sleep.h +0 −3
  16. drivers/acpi/thermal.c +2 −1
  17. drivers/acpi/x86/lpss.c +1 −1
  18. drivers/acpi/x86/s2idle.c +29 −36
  19. drivers/pnp/driver.c +19 −0
  20. include/linux/acpi.h +0 −15
  21. rust/kernel/acpi.rs +1 −3
  22. tools/power/acpi/tools/pfrut/pfrut.c +5 −2
drivers/acpi/acpi_tad.c+39−34
@@ -90,19 +90,18 @@ static int acpi_tad_set_real_time(struct device *dev, struct acpi_tad_rt *rt) · 89 unmodified lines
9090 args[0].buffer.pointer = (u8 *)rt;
9191 args[0].buffer.length = sizeof(*rt);
9292
93− pm_runtime_get_sync(dev);
93+ ACQUIRE(pm_runtime_active_try, pm)(dev);
94+ if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
95+ return -ENXIO;
9496
9597 status = acpi_evaluate_integer(handle, "_SRT", &arg_list, &retval);
96−
97− pm_runtime_put_sync(dev);
98−
9998 if (ACPI_FAILURE(status) || retval)
10099 return -EIO;
101100
102101 return 0;
103102 }
104103
105−static int acpi_tad_get_real_time(struct device *dev, struct acpi_tad_rt *rt)
104+static int acpi_tad_evaluate_grt(struct device *dev, struct acpi_tad_rt *rt)
106105 {
107106 acpi_handle handle = ACPI_HANDLE(dev);
108107 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER };
@@ -111,12 +110,7 @@ static int acpi_tad_get_real_time(struct device *dev, struct acpi_tad_rt *rt) · 2 unmodified lines
111110 acpi_status status;
112111 int ret = -EIO;
113112
114− pm_runtime_get_sync(dev);
115−
116113 status = acpi_evaluate_object(handle, "_GRT", NULL, &output);
117−
118− pm_runtime_put_sync(dev);
119−
120114 if (ACPI_FAILURE(status))
121115 goto out_free;
122116
@@ -139,6 +133,21 @@ out_free: · 16 unmodified lines
139133 return ret;
140134 }
141135
136+static int acpi_tad_get_real_time(struct device *dev, struct acpi_tad_rt *rt)
137+{
138+ int ret;
139+
140+ ACQUIRE(pm_runtime_active_try, pm)(dev);
141+ if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
142+ return -ENXIO;
143+
144+ ret = acpi_tad_evaluate_grt(dev, rt);
145+ if (ret)
146+ return ret;
147+
148+ return 0;
149+}
150+
142151 static char *acpi_tad_rt_next_field(char *s, int *val)
143152 {
144153 char *p;
@@ -266,12 +275,11 @@ static int acpi_tad_wake_set(struct device *dev, char *method, u32 timer_id, · 121 unmodified lines
266275 args[0].integer.value = timer_id;
267276 args[1].integer.value = value;
268277
269− pm_runtime_get_sync(dev);
278+ ACQUIRE(pm_runtime_active_try, pm)(dev);
279+ if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
280+ return -ENXIO;
270281
271282 status = acpi_evaluate_integer(handle, method, &arg_list, &retval);
272−
273− pm_runtime_put_sync(dev);
274−
275283 if (ACPI_FAILURE(status) || retval)
276284 return -EIO;
277285
@@ -314,12 +322,11 @@ static ssize_t acpi_tad_wake_read(struct device *dev, char *buf, char *method, · 36 unmodified lines
314322
315323 args[0].integer.value = timer_id;
316324
317− pm_runtime_get_sync(dev);
325+ ACQUIRE(pm_runtime_active_try, pm)(dev);
326+ if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
327+ return -ENXIO;
318328
319329 status = acpi_evaluate_integer(handle, method, &arg_list, &retval);
320−
321− pm_runtime_put_sync(dev);
322−
323330 if (ACPI_FAILURE(status))
324331 return -EIO;
325332
@@ -370,12 +377,11 @@ static int acpi_tad_clear_status(struct device *dev, u32 timer_id) · 44 unmodified lines
370377
371378 args[0].integer.value = timer_id;
372379
373− pm_runtime_get_sync(dev);
380+ ACQUIRE(pm_runtime_active_try, pm)(dev);
381+ if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
382+ return -ENXIO;
374383
375384 status = acpi_evaluate_integer(handle, "_CWS", &arg_list, &retval);
376−
377− pm_runtime_put_sync(dev);
378−
379385 if (ACPI_FAILURE(status) || retval)
380386 return -EIO;
381387
@@ -411,12 +417,11 @@ static ssize_t acpi_tad_status_read(struct device *dev, char *buf, u32 timer_id) · 29 unmodified lines
411417
412418 args[0].integer.value = timer_id;
413419
414− pm_runtime_get_sync(dev);
420+ ACQUIRE(pm_runtime_active_try, pm)(dev);
421+ if (ACQUIRE_ERR(pm_runtime_active_try, &pm))
422+ return -ENXIO;
415423
416424 status = acpi_evaluate_integer(handle, "_GWS", &arg_list, &retval);
417−
418− pm_runtime_put_sync(dev);
419−
420425 if (ACPI_FAILURE(status))
421426 return -EIO;
422427
@@ -563,8 +568,6 @@ static void acpi_tad_remove(struct platform_device *pdev) · 140 unmodified lines
563568
564569 device_init_wakeup(dev, false);
565570
566− pm_runtime_get_sync(dev);
567−
568571 if (dd->capabilities & ACPI_TAD_RT)
569572 sysfs_remove_group(&dev->kobj, &acpi_tad_time_attr_group);
570573
@@ -573,14 +576,16 @@ static void acpi_tad_remove(struct platform_device *pdev) · 2 unmodified lines
573576
574577 sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group);
575578
576− acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
577− acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
578− if (dd->capabilities & ACPI_TAD_DC_WAKE) {
579− acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
580− acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
579+ scoped_guard(pm_runtime_noresume, dev) {
580+ acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
581+ acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
582+ if (dd->capabilities & ACPI_TAD_DC_WAKE) {
583+ acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
584+ acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
585+ }
581586 }
582587
583− pm_runtime_put_sync(dev);
588+ pm_runtime_suspend(dev);
584589 pm_runtime_disable(dev);
585590 acpi_remove_cmos_rtc_space_handler(handle);
586591 }
drivers/acpi/acpica/nswalk.c+6−3
@@ -169,9 +169,12 @@ acpi_ns_walk_namespace(acpi_object_type type, · 168 unmodified lines
169169
170170 if (start_node == ACPI_ROOT_OBJECT) {
171171 start_node = acpi_gbl_root_node;
172− if (!start_node) {
173− return_ACPI_STATUS(AE_NO_NAMESPACE);
174− }
172+ }
173+
174+ /* Avoid walking the namespace if the StartNode is NULL */
175+
176+ if (!start_node) {
177+ return_ACPI_STATUS(AE_NO_NAMESPACE);
175178 }
176179
177180 /* Null child means "get first node" */
drivers/acpi/battery.c+0−12
@@ -91,7 +91,6 @@ enum { · 90 unmodified lines
9191 };
9292
9393 struct acpi_battery {
94− struct mutex lock;
9594 struct mutex update_lock;
9695 struct power_supply *bat;
9796 struct power_supply_desc bat_desc;
@@ -535,11 +534,9 @@ static int acpi_battery_get_info(struct acpi_battery *battery) · 437 unmodified lines
535534 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
536535 acpi_status status = AE_ERROR;
537536
538− mutex_lock(&battery->lock);
539537 status = acpi_evaluate_object(battery->device->handle,
540538 use_bix ? "_BIX":"_BIF",
541539 NULL, &buffer);
542− mutex_unlock(&battery->lock);
543540
544541 if (ACPI_FAILURE(status)) {
545542 acpi_handle_info(battery->device->handle,
@@ -576,11 +573,8 @@ static int acpi_battery_get_state(struct acpi_battery *battery) · 30 unmodified lines
576573 msecs_to_jiffies(cache_time)))
577574 return 0;
578575
579− mutex_lock(&battery->lock);
580576 status = acpi_evaluate_object(battery->device->handle, "_BST",
581577 NULL, &buffer);
582− mutex_unlock(&battery->lock);
583−
584578 if (ACPI_FAILURE(status)) {
585579 acpi_handle_info(battery->device->handle,
586580 "_BST evaluation failed: %s",
@@ -628,11 +622,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) · 41 unmodified lines
628622 !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags))
629623 return -ENODEV;
630624
631− mutex_lock(&battery->lock);
632625 status = acpi_execute_simple_method(battery->device->handle, "_BTP",
633626 battery->alarm);
634− mutex_unlock(&battery->lock);
635−
636627 if (ACPI_FAILURE(status))
637628 return -ENODEV;
638629
@@ -1235,9 +1226,6 @@ static int acpi_battery_add(struct acpi_device *device) · 596 unmodified lines
12351226 strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
12361227 strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
12371228 device->driver_data = battery;
1238− result = devm_mutex_init(&device->dev, &battery->lock);
1239− if (result)
1240− return result;
12411229
12421230 result = devm_mutex_init(&device->dev, &battery->update_lock);
12431231 if (result)
drivers/acpi/dptf/dptf_pch_fivr.c+1−1
@@ -41,7 +41,7 @@ static int pch_fivr_read(acpi_handle handle, char *method, struct pch_fivr_resp · 40 unmodified lines
4141 ret = 0;
4242
4343 release_buffer:
44− kfree(buffer.pointer);
44+ ACPI_FREE(buffer.pointer);
4545 return ret;
4646 }
4747
drivers/acpi/ec.c+2−1
@@ -2294,7 +2294,8 @@ static int acpi_ec_init_workqueues(void) · 2293 unmodified lines
22942294 ec_wq = alloc_ordered_workqueue("kec", 0);
22952295
22962296 if (!ec_query_wq)
2297− ec_query_wq = alloc_workqueue("kec_query", 0, ec_max_queries);
2297+ ec_query_wq = alloc_workqueue("kec_query", WQ_PERCPU,
2298+ ec_max_queries);
22982299
22992300 if (!ec_wq || !ec_query_wq) {
23002301 acpi_ec_destroy_workqueues();
drivers/acpi/fan.h+40−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #define _ACPI_FAN_H_
1212
1313 #include <linux/kconfig.h>
14+#include <linux/limits.h>
1415
1516 #define ACPI_FAN_DEVICE_IDS \
1617 {"INT3404", }, /* Fan */ \
@@ -55,19 +56,58 @@ struct acpi_fan { · 38 unmodified lines
5556 struct acpi_fan_fif fif;
5657 struct acpi_fan_fps *fps;
5758 int fps_count;
59+ /* A value of 0 means that trippoint-related functions are not supported */
60+ u32 fan_trip_granularity;
61+#if IS_REACHABLE(CONFIG_HWMON)
62+ struct device *hdev;
63+#endif
5864 struct thermal_cooling_device *cdev;
5965 struct device_attribute fst_speed;
6066 struct device_attribute fine_grain_control;
6167 };
6268
69+/**
70+ * acpi_fan_speed_valid - Check if fan speed value is valid
71+ * @speeed: Speed value returned by the ACPI firmware
72+ *
73+ * Check if the fan speed value returned by the ACPI firmware is valid. This function is
74+ * necessary as ACPI firmware implementations can return 0xFFFFFFFF to signal that the
75+ * ACPI fan does not support speed reporting. Additionally, some buggy ACPI firmware
76+ * implementations return a value larger than the 32-bit integer value defined by
77+ * the ACPI specification when using placeholder values. Such invalid values are also
78+ * detected by this function.
79+ *
80+ * Returns: True if the fan speed value is valid, false otherwise.
81+ */
82+static inline bool acpi_fan_speed_valid(u64 speed)
83+{
84+ return speed < U32_MAX;
85+}
86+
87+/**
88+ * acpi_fan_power_valid - Check if fan power value is valid
89+ * @power: Power value returned by the ACPI firmware
90+ *
91+ * Check if the fan power value returned by the ACPI firmware is valid.
92+ * See acpi_fan_speed_valid() for details.
93+ *
94+ * Returns: True if the fan power value is valid, false otherwise.
95+ */
96+static inline bool acpi_fan_power_valid(u64 power)
97+{
98+ return power < U32_MAX;
99+}
100+
63101 int acpi_fan_get_fst(acpi_handle handle, struct acpi_fan_fst *fst);
64102 int acpi_fan_create_attributes(struct acpi_device *device);
65103 void acpi_fan_delete_attributes(struct acpi_device *device);
66104
67105 #if IS_REACHABLE(CONFIG_HWMON)
68106 int devm_acpi_fan_create_hwmon(struct device *dev);
107+void acpi_fan_notify_hwmon(struct device *dev);
69108 #else
70109 static inline int devm_acpi_fan_create_hwmon(struct device *dev) { return 0; };
110+static inline void acpi_fan_notify_hwmon(struct device *dev) { };
71111 #endif
72112
73113 #endif
drivers/acpi/fan_core.c+222−1
@@ -7,11 +7,16 @@ · 6 unmodified lines
77 * Copyright (C) 2022 Intel Corporation. All rights reserved.
88 */
99
10+#include <linux/bits.h>
1011 #include <linux/kernel.h>
12+#include <linux/limits.h>
13+#include <linux/math.h>
14+#include <linux/math64.h>
1115 #include <linux/module.h>
1216 #include <linux/init.h>
1317 #include <linux/types.h>
1418 #include <linux/uaccess.h>
19+#include <linux/uuid.h>
1520 #include <linux/thermal.h>
1621 #include <linux/acpi.h>
1722 #include <linux/platform_device.h>
@@ -19,6 +24,26 @@ · 1 unmodified line
1924
2025 #include "fan.h"
2126
27+#define ACPI_FAN_NOTIFY_STATE_CHANGED 0x80
28+
29+/*
30+ * Defined inside the "Fan Noise Signal" section at
31+ * https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/design-guide.
32+ */
33+static const guid_t acpi_fan_microsoft_guid = GUID_INIT(0xA7611840, 0x99FE, 0x41AE, 0xA4, 0x88,
34+ 0x35, 0xC7, 0x59, 0x26, 0xC8, 0xEB);
35+#define ACPI_FAN_DSM_GET_TRIP_POINT_GRANULARITY 1
36+#define ACPI_FAN_DSM_SET_TRIP_POINTS 2
37+#define ACPI_FAN_DSM_GET_OPERATING_RANGES 3
38+
39+/*
40+ * Ensures that fans with a very low trip point granularity
41+ * do not send too many notifications.
42+ */
43+static uint min_trip_distance = 100;
44+module_param(min_trip_distance, uint, 0);
45+MODULE_PARM_DESC(min_trip_distance, "Minimum distance between fan speed trip points in RPM");
46+
2247 static const struct acpi_device_id fan_device_ids[] = {
2348 ACPI_FAN_DEVICE_IDS,
2449 {"", 0},
@@ -308,6 +333,182 @@ err: · 283 unmodified lines
308333 return status;
309334 }
310335
336+static int acpi_fan_dsm_init(struct device *dev)
337+{
338+ union acpi_object dummy = {
339+ .package = {
340+ .type = ACPI_TYPE_PACKAGE,
341+ .count = 0,
342+ .elements = NULL,
343+ },
344+ };
345+ struct acpi_fan *fan = dev_get_drvdata(dev);
346+ union acpi_object *obj;
347+ int ret = 0;
348+
349+ if (!acpi_check_dsm(fan->handle, &acpi_fan_microsoft_guid, 0,
350+ BIT(ACPI_FAN_DSM_GET_TRIP_POINT_GRANULARITY) |
351+ BIT(ACPI_FAN_DSM_SET_TRIP_POINTS)))
352+ return 0;
353+
354+ dev_info(dev, "Using Microsoft fan extensions\n");
355+
356+ obj = acpi_evaluate_dsm_typed(fan->handle, &acpi_fan_microsoft_guid, 0,
357+ ACPI_FAN_DSM_GET_TRIP_POINT_GRANULARITY, &dummy,
358+ ACPI_TYPE_INTEGER);
359+ if (!obj)
360+ return -EIO;
361+
362+ if (obj->integer.value > U32_MAX)
363+ ret = -EOVERFLOW;
364+ else
365+ fan->fan_trip_granularity = obj->integer.value;
366+
367+ kfree(obj);
368+
369+ return ret;
370+}
371+
372+static int acpi_fan_dsm_set_trip_points(struct device *dev, u64 upper, u64 lower)
373+{
374+ union acpi_object args[2] = {
375+ {
376+ .integer = {
377+ .type = ACPI_TYPE_INTEGER,
378+ .value = lower,
379+ },
380+ },
381+ {
382+ .integer = {
383+ .type = ACPI_TYPE_INTEGER,
384+ .value = upper,
385+ },
386+ },
387+ };
388+ struct acpi_fan *fan = dev_get_drvdata(dev);
389+ union acpi_object in = {
390+ .package = {
391+ .type = ACPI_TYPE_PACKAGE,
392+ .count = ARRAY_SIZE(args),
393+ .elements = args,
394+ },
395+ };
396+ union acpi_object *obj;
397+
398+ obj = acpi_evaluate_dsm(fan->handle, &acpi_fan_microsoft_guid, 0,
399+ ACPI_FAN_DSM_SET_TRIP_POINTS, &in);
400+ kfree(obj);
401+
402+ return 0;
403+}
404+
405+static int acpi_fan_dsm_start(struct device *dev)
406+{
407+ struct acpi_fan *fan = dev_get_drvdata(dev);
408+ int ret;
409+
410+ if (!fan->fan_trip_granularity)
411+ return 0;
412+
413+ /*
414+ * Some firmware implementations only update the values returned by the
415+ * _FST control method when a notification is received. This usually
416+ * works with Microsoft Windows as setting up trip points will keep
417+ * triggering said notifications, but will cause issues when using _FST
418+ * without the Microsoft-specific trip point extension.
419+ *
420+ * Because of this, an initial notification needs to be triggered to
421+ * start the cycle of trip points updates. This is achieved by setting
422+ * the trip points sequencially to two separate ranges. As by the
423+ * Microsoft specification the firmware should trigger a notification
424+ * immediately if the fan speed is outside the trip point range. This
425+ * _should_ result in at least one notification as both ranges do not
426+ * overlap, meaning that the current fan speed needs to be outside at
427+ * least one range.
428+ */
429+ ret = acpi_fan_dsm_set_trip_points(dev, fan->fan_trip_granularity, 0);
430+ if (ret < 0)
431+ return ret;
432+
433+ return acpi_fan_dsm_set_trip_points(dev, fan->fan_trip_granularity * 3,
434+ fan->fan_trip_granularity * 2);
435+}
436+
437+static int acpi_fan_dsm_update_trips_points(struct device *dev, struct acpi_fan_fst *fst)
438+{
439+ struct acpi_fan *fan = dev_get_drvdata(dev);
440+ u64 upper, lower;
441+
442+ if (!fan->fan_trip_granularity)
443+ return 0;
444+
445+ if (!acpi_fan_speed_valid(fst->speed))
446+ return -EINVAL;
447+
448+ upper = roundup_u64(fst->speed + min_trip_distance, fan->fan_trip_granularity);
449+ if (fst->speed <= min_trip_distance) {
450+ lower = 0;
451+ } else {
452+ /*
453+ * Valid fan speed values cannot be larger than 32 bit, so
454+ * we can safely assume that no overflow will happen here.
455+ */
456+ lower = rounddown((u32)fst->speed - min_trip_distance, fan->fan_trip_granularity);
457+ }
458+
459+ return acpi_fan_dsm_set_trip_points(dev, upper, lower);
460+}
461+
462+static void acpi_fan_notify_handler(acpi_handle handle, u32 event, void *context)
463+{
464+ struct device *dev = context;
465+ struct acpi_fan_fst fst;
466+ int ret;
467+
468+ switch (event) {
469+ case ACPI_FAN_NOTIFY_STATE_CHANGED:
470+ /*
471+ * The ACPI specification says that we must evaluate _FST when we
472+ * receive an ACPI event indicating that the fan state has changed.
473+ */
474+ ret = acpi_fan_get_fst(handle, &fst);
475+ if (ret < 0) {
476+ dev_err(dev, "Error retrieving current fan status: %d\n", ret);
477+ } else {
478+ ret = acpi_fan_dsm_update_trips_points(dev, &fst);
479+ if (ret < 0)
480+ dev_err(dev, "Failed to update trip points: %d\n", ret);
481+ }
482+
483+ acpi_fan_notify_hwmon(dev);
484+ acpi_bus_generate_netlink_event("fan", dev_name(dev), event, 0);
485+ break;
486+ default:
487+ dev_dbg(dev, "Unsupported ACPI notification 0x%x\n", event);
488+ break;
489+ }
490+}
491+
492+static void acpi_fan_notify_remove(void *data)
493+{
494+ struct acpi_fan *fan = data;
495+
496+ acpi_remove_notify_handler(fan->handle, ACPI_DEVICE_NOTIFY, acpi_fan_notify_handler);
497+}
498+
499+static int devm_acpi_fan_notify_init(struct device *dev)
500+{
501+ struct acpi_fan *fan = dev_get_drvdata(dev);
502+ acpi_status status;
503+
504+ status = acpi_install_notify_handler(fan->handle, ACPI_DEVICE_NOTIFY,
505+ acpi_fan_notify_handler, dev);
506+ if (ACPI_FAILURE(status))
507+ return -EIO;
508+
509+ return devm_add_action_or_reset(dev, acpi_fan_notify_remove, fan);
510+}
511+
311512 static int acpi_fan_probe(struct platform_device *pdev)
312513 {
313514 int result = 0;
@@ -347,10 +548,24 @@ static int acpi_fan_probe(struct platform_device *pdev) · 33 unmodified lines
347548 }
348549
349550 if (fan->has_fst) {
551+ result = acpi_fan_dsm_init(&pdev->dev);
552+ if (result)
553+ return result;
554+
350555 result = devm_acpi_fan_create_hwmon(&pdev->dev);
351556 if (result)
352557 return result;
353558
559+ result = devm_acpi_fan_notify_init(&pdev->dev);
560+ if (result)
561+ return result;
562+
563+ result = acpi_fan_dsm_start(&pdev->dev);
564+ if (result) {
565+ dev_err(&pdev->dev, "Failed to start Microsoft fan extensions\n");
566+ return result;
567+ }
568+
354569 result = acpi_fan_create_attributes(device);
355570 if (result)
356571 return result;
@@ -436,8 +651,14 @@ static int acpi_fan_suspend(struct device *dev) · 79 unmodified lines
436651
437652 static int acpi_fan_resume(struct device *dev)
438653 {
439− int result;
440654 struct acpi_fan *fan = dev_get_drvdata(dev);
655+ int result;
656+
657+ if (fan->has_fst) {
658+ result = acpi_fan_dsm_start(dev);
659+ if (result)
660+ dev_err(dev, "Failed to start Microsoft fan extensions: %d\n", result);
661+ }
441662
442663 if (fan->acpi4)
443664 return 0;
drivers/acpi/fan_hwmon.c+14−11
@@ -15,10 +15,6 @@ · 14 unmodified lines
1515
1616 #include "fan.h"
1717
18−/* Returned when the ACPI fan does not support speed reporting */
19−#define FAN_SPEED_UNAVAILABLE U32_MAX
20−#define FAN_POWER_UNAVAILABLE U32_MAX
21−
2218 static struct acpi_fan_fps *acpi_fan_get_current_fps(struct acpi_fan *fan, u64 control)
2319 {
2420 unsigned int i;
@@ -77,7 +73,7 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_ · 52 unmodified lines
7773 * when the associated attribute should not be created.
7874 */
7975 for (i = 0; i < fan->fps_count; i++) {
80− if (fan->fps[i].power != FAN_POWER_UNAVAILABLE)
76+ if (acpi_fan_power_valid(fan->fps[i].power))
8177 return 0444;
8278 }
8379
@@ -106,7 +102,7 @@ static int acpi_fan_hwmon_read(struct device *dev, enum hwmon_sensor_types type, · 22 unmodified lines
106102 case hwmon_fan:
107103 switch (attr) {
108104 case hwmon_fan_input:
109− if (fst.speed == FAN_SPEED_UNAVAILABLE)
105+ if (!acpi_fan_speed_valid(fst.speed))
110106 return -ENODEV;
111107
112108 if (fst.speed > LONG_MAX)
@@ -134,7 +130,7 @@ static int acpi_fan_hwmon_read(struct device *dev, enum hwmon_sensor_types type, · 21 unmodified lines
134130 if (!fps)
135131 return -EIO;
136132
137− if (fps->power == FAN_POWER_UNAVAILABLE)
133+ if (!acpi_fan_power_valid(fps->power))
138134 return -ENODEV;
139135
140136 if (fps->power > LONG_MAX / MICROWATT_PER_MILLIWATT)
@@ -166,12 +162,19 @@ static const struct hwmon_chip_info acpi_fan_hwmon_chip_info = { · 25 unmodified lines
166162 .info = acpi_fan_hwmon_info,
167163 };
168164
165+void acpi_fan_notify_hwmon(struct device *dev)
166+{
167+ struct acpi_fan *fan = dev_get_drvdata(dev);
168+
169+ hwmon_notify_event(fan->hdev, hwmon_fan, hwmon_fan_input, 0);
170+}
171+
169172 int devm_acpi_fan_create_hwmon(struct device *dev)
170173 {
171174 struct acpi_fan *fan = dev_get_drvdata(dev);
172− struct device *hdev;
173175
174− hdev = devm_hwmon_device_register_with_info(dev, "acpi_fan", fan, &acpi_fan_hwmon_chip_info,
175− NULL);
176− return PTR_ERR_OR_ZERO(hdev);
176+ fan->hdev = devm_hwmon_device_register_with_info(dev, "acpi_fan", fan,
177+ &acpi_fan_hwmon_chip_info, NULL);
178+
179+ return PTR_ERR_OR_ZERO(fan->hdev);
177180 }
drivers/acpi/osl.c+3−3
@@ -398,7 +398,7 @@ static void acpi_os_drop_map_ref(struct acpi_ioremap *map) · 397 unmodified lines
398398 list_del_rcu(&map->list);
399399
400400 INIT_RCU_WORK(&map->track.rwork, acpi_os_map_remove);
401− queue_rcu_work(system_wq, &map->track.rwork);
401+ queue_rcu_work(system_percpu_wq, &map->track.rwork);
402402 }
403403
404404 /**
@@ -1694,8 +1694,8 @@ acpi_status __init acpi_os_initialize(void) · 1289 unmodified lines
16941694
16951695 acpi_status __init acpi_os_initialize1(void)
16961696 {
1697− kacpid_wq = alloc_workqueue("kacpid", 0, 1);
1698− kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 0);
1697+ kacpid_wq = alloc_workqueue("kacpid", WQ_PERCPU, 1);
1698+ kacpi_notify_wq = alloc_workqueue("kacpi_notify", WQ_PERCPU, 0);
16991699 kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0);
17001700 BUG_ON(!kacpid_wq);
17011701 BUG_ON(!kacpi_notify_wq);
drivers/acpi/processor_core.c+1−1
@@ -54,7 +54,7 @@ static int map_x2apic_id(struct acpi_subtable_header *entry, · 53 unmodified lines
5454 if (!(apic->lapic_flags & ACPI_MADT_ENABLED))
5555 return -ENODEV;
5656
57− if (device_declaration && (apic->uid == acpi_id)) {
57+ if (apic->uid == acpi_id && (device_declaration || acpi_id < 255)) {
5858 *apic_id = apic->local_apic_id;
5959 return 0;
6060 }
drivers/acpi/processor_idle.c+16−26
@@ -732,18 +732,16 @@ static int __cpuidle acpi_idle_enter_s2idle(struct cpuidle_device *dev, · 731 unmodified lines
732732 return 0;
733733 }
734734
735−static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
736− struct cpuidle_device *dev)
735+static void acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
736+ struct cpuidle_device *dev)
737737 {
738738 int i, count = ACPI_IDLE_STATE_START;
739739 struct acpi_processor_cx *cx;
740− struct cpuidle_state *state;
741740
742741 if (max_cstate == 0)
743742 max_cstate = 1;
744743
745744 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
746− state = &acpi_idle_driver.states[count];
747745 cx = &pr->power.states[i];
748746
749747 if (!cx->valid)
@@ -751,27 +749,13 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, · 1 unmodified line
751749
752750 per_cpu(acpi_cstate[count], dev->cpu) = cx;
753751
754− if (lapic_timer_needs_broadcast(pr, cx))
755− state->flags |= CPUIDLE_FLAG_TIMER_STOP;
756−
757− if (cx->type == ACPI_STATE_C3) {
758− state->flags |= CPUIDLE_FLAG_TLB_FLUSHED;
759− if (pr->flags.bm_check)
760− state->flags |= CPUIDLE_FLAG_RCU_IDLE;
761− }
762−
763752 count++;
764753 if (count == CPUIDLE_STATE_MAX)
765754 break;
766755 }
767−
768− if (!count)
769− return -EINVAL;
770−
771− return 0;
772756 }
773757
774−static int acpi_processor_setup_cstates(struct acpi_processor *pr)
758+static void acpi_processor_setup_cstates(struct acpi_processor *pr)
775759 {
776760 int i, count;
777761 struct acpi_processor_cx *cx;
@@ -818,17 +802,21 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr) · 40 unmodified lines
818802 if (cx->type != ACPI_STATE_C1 && !acpi_idle_fallback_to_c1(pr))
819803 state->enter_s2idle = acpi_idle_enter_s2idle;
820804
805+ if (lapic_timer_needs_broadcast(pr, cx))
806+ state->flags |= CPUIDLE_FLAG_TIMER_STOP;
807+
808+ if (cx->type == ACPI_STATE_C3) {
809+ state->flags |= CPUIDLE_FLAG_TLB_FLUSHED;
810+ if (pr->flags.bm_check)
811+ state->flags |= CPUIDLE_FLAG_RCU_IDLE;
812+ }
813+
821814 count++;
822815 if (count == CPUIDLE_STATE_MAX)
823816 break;
824817 }
825818
826819 drv->state_count = count;
827−
828− if (!count)
829− return -EINVAL;
830−
831− return 0;
832820 }
833821
834822 static inline void acpi_processor_cstate_first_run_checks(void)
@@ -1243,7 +1231,8 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) · 408 unmodified lines
12431231 if (pr->flags.has_lpi)
12441232 return acpi_processor_setup_lpi_states(pr);
12451233
1246− return acpi_processor_setup_cstates(pr);
1234+ acpi_processor_setup_cstates(pr);
1235+ return 0;
12471236 }
12481237
12491238 /**
@@ -1263,7 +1252,8 @@ static int acpi_processor_setup_cpuidle_dev(struct acpi_processor *pr, · 13 unmodified lines
12631252 if (pr->flags.has_lpi)
12641253 return acpi_processor_ffh_lpi_probe(pr->id);
12651254
1266− return acpi_processor_setup_cpuidle_cx(pr, dev);
1255+ acpi_processor_setup_cpuidle_cx(pr, dev);
1256+ return 0;
12671257 }
12681258
12691259 static int acpi_processor_get_power_info(struct acpi_processor *pr)
drivers/acpi/property.c+17−12
@@ -1280,7 +1280,7 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, · 1279 unmodified lines
12801280 ret = acpi_copy_property_array_uint(items, (u64 *)val, nval);
12811281 break;
12821282 case DEV_PROP_STRING:
1283− nval = min_t(u32, nval, obj->package.count);
1283+ nval = min(nval, obj->package.count);
12841284 if (nval == 0)
12851285 return -ENODATA;
12861286
@@ -1329,13 +1329,14 @@ static int stop_on_next(struct acpi_device *adev, void *data) · 42 unmodified lines
13291329 return 0;
13301330 }
13311331
1332−/**
1332+/*
13331333 * acpi_get_next_subnode - Return the next child node handle for a fwnode
13341334 * @fwnode: Firmware node to find the next child node for.
13351335 * @child: Handle to one of the device's child nodes or a null handle.
13361336 */
1337−struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
1338− struct fwnode_handle *child)
1337+static struct fwnode_handle *
1338+acpi_get_next_subnode(const struct fwnode_handle *fwnode,
1339+ struct fwnode_handle *child)
13391340 {
13401341 struct acpi_device *adev = to_acpi_device_node(fwnode);
13411342
@@ -1472,7 +1473,7 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint( · 130 unmodified lines
14721473
14731474 if (!prev) {
14741475 do {
1475− port = fwnode_get_next_child_node(fwnode, port);
1476+ port = acpi_get_next_subnode(fwnode, port);
14761477 /*
14771478 * The names of the port nodes begin with "port@"
14781479 * followed by the number of the port node and they also
@@ -1490,14 +1491,17 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint( · 11 unmodified lines
14901491 if (!port)
14911492 return NULL;
14921493
1493− endpoint = fwnode_get_next_child_node(port, prev);
1494− while (!endpoint) {
1495− port = fwnode_get_next_child_node(fwnode, port);
1496− if (!port)
1494+ do {
1495+ endpoint = acpi_get_next_subnode(port, prev);
1496+ if (endpoint)
14971497 break;
1498− if (is_acpi_graph_node(port, "port"))
1499− endpoint = fwnode_get_next_child_node(port, NULL);
1500− }
1498+
1499+ prev = NULL;
1500+
1501+ do {
1502+ port = acpi_get_next_subnode(fwnode, port);
1503+ } while (port && !is_acpi_graph_node(port, "port"));
1504+ } while (port);
15011505
15021506 /*
15031507 * The names of the endpoint nodes begin with "endpoint@" followed by
@@ -1714,6 +1718,7 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, · 210 unmodified lines
17141718 if (fwnode_property_read_u32(fwnode, "reg", &endpoint->id))
17151719 fwnode_property_read_u32(fwnode, "endpoint", &endpoint->id);
17161720
1721+ fwnode_handle_put(port_fwnode);
17171722 return 0;
17181723 }
17191724
drivers/acpi/scan.c+1−1
@@ -2397,7 +2397,7 @@ static bool acpi_scan_clear_dep_queue(struct acpi_device *adev) · 2396 unmodified lines
23972397 * initial enumeration of devices is complete, put it into the unbound
23982398 * workqueue.
23992399 */
2400− queue_work(system_unbound_wq, &cdw->work);
2400+ queue_work(system_dfl_wq, &cdw->work);
24012401
24022402 return true;
24032403 }
drivers/acpi/sleep.c+1−1
@@ -642,7 +642,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) · 641 unmodified lines
642642 /*
643643 * Disable all GPE and clear their status bits before interrupts are
644644 * enabled. Some GPEs (like wakeup GPEs) have no handlers and this can
645− * prevent them from producing spurious interrups.
645+ * prevent them from producing spurious interrupts.
646646 *
647647 * acpi_leave_sleep_state() will reenable specific GPEs later.
648648 *
drivers/acpi/sleep.h+0−3
@@ -17,10 +17,7 @@ static inline acpi_status acpi_set_waking_vector(u32 wakeup_address) · 16 unmodified lines
1717
1818 extern int acpi_s2idle_begin(void);
1919 extern int acpi_s2idle_prepare(void);
20−extern int acpi_s2idle_prepare_late(void);
21−extern void acpi_s2idle_check(void);
2220 extern bool acpi_s2idle_wake(void);
23−extern void acpi_s2idle_restore_early(void);
2421 extern void acpi_s2idle_restore(void);
2522 extern void acpi_s2idle_end(void);
2623
drivers/acpi/thermal.c+2−1
@@ -1060,7 +1060,8 @@ static int __init acpi_thermal_init(void) · 1059 unmodified lines
10601060 }
10611061
10621062 acpi_thermal_pm_queue = alloc_workqueue("acpi_thermal_pm",
1063− WQ_HIGHPRI | WQ_MEM_RECLAIM, 0);
1063+ WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_PERCPU,
1064+ 0);
10641065 if (!acpi_thermal_pm_queue)
10651066 return -ENODEV;
10661067
drivers/acpi/x86/lpss.c+1−1
@@ -181,7 +181,7 @@ static void byt_i2c_setup(struct lpss_private_data *pdata) · 180 unmodified lines
181181 acpi_status status;
182182 u64 uid;
183183
184− /* Expected to always be successfull, but better safe then sorry */
184+ /* Expected to always be successful, but better safe then sorry */
185185 if (!acpi_dev_uid_to_integer(pdata->adev, &uid) && uid) {
186186 /* Detect I2C bus shared with PUNIT and ignore its d3 status */
187187 status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
drivers/acpi/x86/s2idle.c+29−36
@@ -299,34 +299,13 @@ free_acpi_buffer: · 298 unmodified lines
299299 ACPI_FREE(out_obj);
300300 }
301301
302−/**
303− * acpi_get_lps0_constraint - Get the LPS0 constraint for a device.
304− * @adev: Device to get the constraint for.
305− *
306− * The LPS0 constraint is the shallowest (minimum) power state in which the
307− * device can be so as to allow the platform as a whole to achieve additional
308− * energy conservation by utilizing a system-wide low-power state.
309− *
310− * Returns:
311− * - ACPI power state value of the constraint for @adev on success.
312− * - Otherwise, ACPI_STATE_UNKNOWN.
313− */
314−int acpi_get_lps0_constraint(struct acpi_device *adev)
315−{
316− struct lpi_constraints *entry;
317−
318− for_each_lpi_constraint(entry) {
319− if (adev->handle == entry->handle)
320− return entry->min_dstate;
321− }
322−
323− return ACPI_STATE_UNKNOWN;
324−}
325−
326302 static void lpi_check_constraints(void)
327303 {
328304 struct lpi_constraints *entry;
329305
306+ if (IS_ERR_OR_NULL(lpi_constraints_table))
307+ return;
308+
330309 for_each_lpi_constraint(entry) {
331310 struct acpi_device *adev = acpi_fetch_acpi_dev(entry->handle);
332311
@@ -508,11 +487,6 @@ static int lps0_device_attach(struct acpi_device *adev, · 175 unmodified lines
508487
509488 lps0_device_handle = adev->handle;
510489
511− if (acpi_s2idle_vendor_amd())
512− lpi_device_get_constraints_amd();
513− else
514− lpi_device_get_constraints();
515−
516490 /*
517491 * Use suspend-to-idle by default if ACPI_FADT_LOW_POWER_S0 is set in
518492 * the FADT and the default suspend mode was not set from the command
@@ -539,7 +513,26 @@ static struct acpi_scan_handler lps0_handler = { · 20 unmodified lines
539513 .attach = lps0_device_attach,
540514 };
541515
542−int acpi_s2idle_prepare_late(void)
516+static int acpi_s2idle_begin_lps0(void)
517+{
518+ if (pm_debug_messages_on && !lpi_constraints_table) {
519+ if (acpi_s2idle_vendor_amd())
520+ lpi_device_get_constraints_amd();
521+ else
522+ lpi_device_get_constraints();
523+
524+ /*
525+ * Try to retrieve the constraints only once because failures
526+ * to do so usually are sticky.
527+ */
528+ if (!lpi_constraints_table)
529+ lpi_constraints_table = ERR_PTR(-ENODATA);
530+ }
531+
532+ return acpi_s2idle_begin();
533+}
534+
535+static int acpi_s2idle_prepare_late_lps0(void)
543536 {
544537 struct acpi_s2idle_dev_ops *handler;
545538
@@ -585,7 +578,7 @@ int acpi_s2idle_prepare_late(void) · 39 unmodified lines
585578 return 0;
586579 }
587580
588−void acpi_s2idle_check(void)
581+static void acpi_s2idle_check_lps0(void)
589582 {
590583 struct acpi_s2idle_dev_ops *handler;
591584
@@ -598,7 +591,7 @@ void acpi_s2idle_check(void) · 6 unmodified lines
598591 }
599592 }
600593
601−void acpi_s2idle_restore_early(void)
594+static void acpi_s2idle_restore_early_lps0(void)
602595 {
603596 struct acpi_s2idle_dev_ops *handler;
604597
@@ -636,12 +629,12 @@ void acpi_s2idle_restore_early(void) · 31 unmodified lines
636629 }
637630
638631 static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
639− .begin = acpi_s2idle_begin,
632+ .begin = acpi_s2idle_begin_lps0,
640633 .prepare = acpi_s2idle_prepare,
641− .prepare_late = acpi_s2idle_prepare_late,
642− .check = acpi_s2idle_check,
634+ .prepare_late = acpi_s2idle_prepare_late_lps0,
635+ .check = acpi_s2idle_check_lps0,
643636 .wake = acpi_s2idle_wake,
644− .restore_early = acpi_s2idle_restore_early,
637+ .restore_early = acpi_s2idle_restore_early_lps0,
645638 .restore = acpi_s2idle_restore,
646639 .end = acpi_s2idle_end,
647640 };
drivers/pnp/driver.c+19−0
@@ -150,6 +150,24 @@ static void pnp_device_shutdown(struct device *dev) · 149 unmodified lines
150150 drv->shutdown(pnp_dev);
151151 }
152152
153+static int pnp_uevent(const struct device *dev, struct kobj_uevent_env *env)
154+{
155+ struct pnp_id *pos;
156+ const struct pnp_dev *pnp_dev = to_pnp_dev(dev);
157+
158+ if (!dev)
159+ return -ENODEV;
160+
161+ pos = pnp_dev->id;
162+ while (pos) {
163+ if (add_uevent_var(env, "MODALIAS=pnp:d%s", pos->id))
164+ return -ENOMEM;
165+ pos = pos->next;
166+ }
167+
168+ return 0;
169+}
170+
153171 static int pnp_bus_match(struct device *dev, const struct device_driver *drv)
154172 {
155173 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
@@ -259,6 +277,7 @@ static const struct dev_pm_ops pnp_bus_dev_pm_ops = { · 103 unmodified lines
259277 const struct bus_type pnp_bus_type = {
260278 .name = "pnp",
261279 .match = pnp_bus_match,
280+ .uevent = pnp_uevent,
262281 .probe = pnp_device_probe,
263282 .remove = pnp_device_remove,
264283 .shutdown = pnp_device_shutdown,
include/linux/acpi.h+0−15
@@ -1157,12 +1157,7 @@ struct acpi_s2idle_dev_ops { · 1156 unmodified lines
11571157 #if defined(CONFIG_SUSPEND) && defined(CONFIG_X86)
11581158 int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg);
11591159 void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg);
1160−int acpi_get_lps0_constraint(struct acpi_device *adev);
11611160 #else /* CONFIG_SUSPEND && CONFIG_X86 */
1162−static inline int acpi_get_lps0_constraint(struct device *dev)
1163−{
1164− return ACPI_STATE_UNKNOWN;
1165−}
11661161 static inline int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg)
11671162 {
11681163 return -ENODEV;
@@ -1360,9 +1355,6 @@ acpi_data_add_props(struct acpi_device_data *data, const guid_t *guid, · 191 unmodified lines
13601355 int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,
13611356 void **valptr);
13621357
1363−struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
1364− struct fwnode_handle *child);
1365−
13661358 struct acpi_probe_entry;
13671359 typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
13681360 struct acpi_probe_entry *);
@@ -1461,13 +1453,6 @@ static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode, · 92 unmodified lines
14611453 return -ENXIO;
14621454 }
14631455
1464−static inline struct fwnode_handle *
1465−acpi_get_next_subnode(const struct fwnode_handle *fwnode,
1466− struct fwnode_handle *child)
1467−{
1468− return NULL;
1469−}
1470−
14711456 static inline struct fwnode_handle *
14721457 acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
14731458 struct fwnode_handle *prev)
rust/kernel/acpi.rs+1−3
@@ -39,9 +39,7 @@ impl DeviceId { · 38 unmodified lines
3939 pub const fn new(id: &'static CStr) -> Self {
4040 let src = id.to_bytes_with_nul();
4141 build_assert!(src.len() <= Self::ACPI_ID_LEN, "ID exceeds 16 bytes");
42− // Replace with `bindings::acpi_device_id::default()` once stabilized for `const`.
43− // SAFETY: FFI type is valid to be zero-initialized.
44− let mut acpi: bindings::acpi_device_id = unsafe { core::mem::zeroed() };
42+ let mut acpi: bindings::acpi_device_id = pin_init::zeroed();
4543 let mut i = 0;
4644 while i < src.len() {
4745 acpi.id[i] = src[i];
tools/power/acpi/tools/pfrut/pfrut.c+5−2
@@ -222,6 +222,7 @@ int main(int argc, char *argv[]) · 221 unmodified lines
222222 fd_update_log = open("/dev/acpi_pfr_telemetry0", O_RDWR);
223223 if (fd_update_log < 0) {
224224 printf("PFRT device not supported - Quit...\n");
225+ close(fd_update);
225226 return 1;
226227 }
227228
@@ -265,7 +266,8 @@ int main(int argc, char *argv[]) · 37 unmodified lines
265266 printf("chunk2_size:%d\n", data_info.chunk2_size);
266267 printf("rollover_cnt:%d\n", data_info.rollover_cnt);
267268 printf("reset_cnt:%d\n", data_info.reset_cnt);
268−
269+ close(fd_update);
270+ close(fd_update_log);
269271 return 0;
270272 }
271273
@@ -358,6 +360,7 @@ int main(int argc, char *argv[]) · 86 unmodified lines
358360
359361 if (ret == -1) {
360362 perror("Failed to load capsule file");
363+ munmap(addr_map_capsule, st.st_size);
361364 close(fd_capsule);
362365 close(fd_update);
363366 close(fd_update_log);
@@ -420,7 +423,7 @@ int main(int argc, char *argv[]) · 56 unmodified lines
420423 if (p_mmap == MAP_FAILED) {
421424 perror("mmap error.");
422425 close(fd_update_log);
423−
426+ free(log_buf);
424427 return 1;
425428 }
426429