Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull ACPI updates from Rafael Wysocki:
"These eliminate significant AML processing overhead related to using
operation regions in system memory, update the ACPICA code in the
kernel to upstream revision 20200717 (including a fix to prevent
operation region reference counts from overflowing in some cases),
remove the last bits of the (long deprecated) ACPI procfs interface
and do some assorted cleanups.

Specifics:

- Eliminate significant AML processing overhead related to using
operation regions in system memory by reworking the management of
memory mappings in the ACPI code to defer unmap operations (to do
them outside of the ACPICA locks, among other things) and making
the memory operation reagion handler avoid releasing memory
mappings created by it too early (Rafael Wysocki).

- Update the ACPICA code in the kernel to upstream revision 20200717:

* Prevent operation region reference counts from overflowing in
some cases (Erik Kaneda).

* Replace one-element array with flexible-array (Gustavo A. R.
Silva).

- Fix ACPI PCI hotplug reference counting (Rafael Wysocki).

- Drop last bits of the ACPI procfs interface (Thomas Renninger).

- Drop some redundant checks from the code parsing ACPI tables
related to NUMA (Hanjun Guo).

- Avoid redundant object evaluation in the ACPI device properties
handling code (Heikki Krogerus).

- Avoid unecessary memory overhead related to storing the signatures
of the ACPI tables recognized by the kernel (Ard Biesheuvel).

- Add missing newline characters when printing module parameter
values in some places (Xiongfeng Wang).

- Update the link to the ACPI specifications in some places (Tiezhu
Yang).

- Use the fallthrough pseudo-keyword in the ACPI code (Gustavo A. R.
Silva).

- Drop redundant variable initialization from the APEI code (Colin
Ian King).

- Drop uninitialized_var() from the ACPI PAD driver (Jason Yan).

- Replace HTTP links with HTTPS ones in the ACPI code (Alexander A.
Klimov)"

* tag 'acpi-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (22 commits)
ACPI: APEI: remove redundant assignment to variable rc
ACPI: NUMA: Remove the useless 'node >= MAX_NUMNODES' check
ACPI: NUMA: Remove the useless sub table pointer check
ACPI: tables: Remove the duplicated checks for acpi_parse_entries_array()
ACPICA: Update version to 20200717
ACPICA: Do not increment operation_region reference counts for field units
ACPICA: Replace one-element array with flexible-array
ACPI: Replace HTTP links with HTTPS ones
ACPI: Use valid link to the ACPI specification
ACPI: OSL: Clean up the removal of unused memory mappings
ACPI: OSL: Use deferred unmapping in acpi_os_unmap_iomem()
ACPI: OSL: Use deferred unmapping in acpi_os_unmap_generic_address()
ACPICA: Preserve memory opregion mappings
ACPI: OSL: Implement deferred unmapping of ACPI memory
ACPI: Use fallthrough pseudo-keyword
PCI: hotplug: ACPI: Fix context refcounting in acpiphp_grab_context()
ACPI: tables: avoid relocations for table signature array
ACPI: PAD: Eliminate usage of uninitialized_var() macro
ACPI: sysfs: add newlines when printing module parameters
ACPI: EC: add newline when printing 'ec_event_clearing' module parameter
...

+168 -621
+2 -2
Documentation/firmware-guide/acpi/DSD-properties-rules.rst
··· 96 96 References 97 97 ========== 98 98 99 - .. [1] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf 100 - .. [2] http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf 99 + .. [1] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf 100 + .. [2] https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf
+2 -2
Documentation/firmware-guide/acpi/dsd/data-node-references.rst
··· 85 85 ========== 86 86 87 87 [1] Hierarchical Data Extension UUID For _DSD. 88 - <http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 88 + <https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 89 89 referenced 2018-07-17. 90 90 91 91 [2] Device Properties UUID For _DSD. 92 - <http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 92 + <https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 93 93 referenced 2016-10-04.
+5 -5
Documentation/firmware-guide/acpi/dsd/graph.rst
··· 154 154 ========== 155 155 156 156 [1] _DSD (Device Specific Data) Implementation Guide. 157 - http://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm, 157 + https://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm, 158 158 referenced 2016-10-03. 159 159 160 - [2] Devicetree. http://www.devicetree.org, referenced 2016-10-03. 160 + [2] Devicetree. https://www.devicetree.org, referenced 2016-10-03. 161 161 162 162 [3] Documentation/devicetree/bindings/graph.txt 163 163 164 164 [4] Device Properties UUID For _DSD. 165 - http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf, 165 + https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf, 166 166 referenced 2016-10-04. 167 167 168 168 [5] Hierarchical Data Extension UUID For _DSD. 169 - http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf, 169 + https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf, 170 170 referenced 2016-10-04. 171 171 172 172 [6] Advanced Configuration and Power Interface Specification. 173 - http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf, 173 + https://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf, 174 174 referenced 2016-10-04. 175 175 176 176 [7] _DSD Device Properties Usage Rules.
+3 -3
Documentation/firmware-guide/acpi/dsd/leds.rst
··· 90 90 References 91 91 ========== 92 92 93 - [1] Device tree. <URL:http://www.devicetree.org>, referenced 2019-02-21. 93 + [1] Device tree. <URL:https://www.devicetree.org>, referenced 2019-02-21. 94 94 95 95 [2] Advanced Configuration and Power Interface Specification. 96 96 <URL:https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf>, ··· 101 101 [4] Documentation/devicetree/bindings/media/video-interfaces.txt 102 102 103 103 [5] Device Properties UUID For _DSD. 104 - <URL:http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 104 + <URL:https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>, 105 105 referenced 2019-02-21. 106 106 107 107 [6] Hierarchical Data Extension UUID For _DSD. 108 - <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 108 + <URL:https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 109 109 referenced 2019-02-21. 110 110 111 111 [7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
+1 -1
Documentation/firmware-guide/acpi/lpit.rst
··· 7 7 To enumerate platform Low Power Idle states, Intel platforms are using 8 8 “Low Power Idle Table” (LPIT). More details about this table can be 9 9 downloaded from: 10 - http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf 10 + https://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf 11 11 12 12 Residencies for each low power state can be read via FFH 13 13 (Function fixed hardware) or a memory mapped interface.
+1 -1
Documentation/hwmon/acpi_power_meter.rst
··· 9 9 10 10 Prefix: 'power_meter' 11 11 12 - Datasheet: http://acpi.info/, section 10.4. 12 + Datasheet: https://uefi.org/specifications, section 10.4. 13 13 14 14 Author: Darrick J. Wong 15 15
+2 -20
drivers/acpi/Kconfig
··· 32 32 Linux support for ACPI is based on Intel Corporation's ACPI 33 33 Component Architecture (ACPI CA). For more information on the 34 34 ACPI CA, see: 35 - <http://acpica.org/> 35 + <https://acpica.org/> 36 36 37 37 ACPI is an open industry specification originally co-developed by 38 38 Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. Currently, ··· 40 40 the UEFI Forum and any UEFI member can join the ASWG and contribute 41 41 to the ACPI specification. 42 42 The specification is available at: 43 - <http://www.acpi.info> 44 - <http://www.uefi.org/acpi/specs> 43 + <https://uefi.org/specifications> 45 44 46 45 if ACPI 47 46 ··· 97 98 depends on SUSPEND || HIBERNATION 98 99 depends on ACPI_SYSTEM_POWER_STATES_SUPPORT 99 100 default y 100 - 101 - config ACPI_PROCFS_POWER 102 - bool "Deprecated power /proc/acpi directories" 103 - depends on X86 && PROC_FS 104 - help 105 - For backwards compatibility, this option allows 106 - deprecated power /proc/acpi/ directories to exist, even when 107 - they have been replaced by functions in /sys. 108 - The deprecated directories (and their replacements) include: 109 - /proc/acpi/battery/* (/sys/class/power_supply/*) and 110 - /proc/acpi/ac_adapter/* (sys/class/power_supply/*). 111 - This option has no effect on /proc/acpi/ directories 112 - and functions which do not yet exist in /sys. 113 - This option, together with the proc directories, will be 114 - deleted in the future. 115 - 116 - Say N to delete power /proc/acpi/ directories that have moved to /sys. 117 101 118 102 config ACPI_REV_OVERRIDE_POSSIBLE 119 103 bool "Allow supported ACPI revision to be overridden"
-1
drivers/acpi/Makefile
··· 55 55 acpi-$(CONFIG_X86) += x86/apple.o 56 56 acpi-$(CONFIG_X86) += x86/utils.o 57 57 acpi-$(CONFIG_DEBUG_FS) += debugfs.o 58 - acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o 59 58 acpi-y += acpi_lpat.o 60 59 acpi-$(CONFIG_ACPI_LPIT) += acpi_lpit.o 61 60 acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
+1 -107
drivers/acpi/ac.c
··· 13 13 #include <linux/types.h> 14 14 #include <linux/dmi.h> 15 15 #include <linux/delay.h> 16 - #ifdef CONFIG_ACPI_PROCFS_POWER 17 - #include <linux/proc_fs.h> 18 - #include <linux/seq_file.h> 19 - #endif 20 16 #include <linux/platform_device.h> 21 17 #include <linux/power_supply.h> 22 18 #include <linux/acpi.h> ··· 61 65 static int acpi_ac_resume(struct device *dev); 62 66 #endif 63 67 static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); 64 - 65 - #ifdef CONFIG_ACPI_PROCFS_POWER 66 - extern struct proc_dir_entry *acpi_lock_ac_dir(void); 67 - extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 68 - #endif 69 - 70 68 71 69 static int ac_sleep_before_get_state_ms; 72 70 static int ac_check_pmic = 1; ··· 140 150 POWER_SUPPLY_PROP_ONLINE, 141 151 }; 142 152 143 - #ifdef CONFIG_ACPI_PROCFS_POWER 144 - /* -------------------------------------------------------------------------- 145 - FS Interface (/proc) 146 - -------------------------------------------------------------------------- */ 147 - 148 - static struct proc_dir_entry *acpi_ac_dir; 149 - 150 - static int acpi_ac_seq_show(struct seq_file *seq, void *offset) 151 - { 152 - struct acpi_ac *ac = seq->private; 153 - 154 - 155 - if (!ac) 156 - return 0; 157 - 158 - if (acpi_ac_get_state(ac)) { 159 - seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); 160 - return 0; 161 - } 162 - 163 - seq_puts(seq, "state: "); 164 - switch (ac->state) { 165 - case ACPI_AC_STATUS_OFFLINE: 166 - seq_puts(seq, "off-line\n"); 167 - break; 168 - case ACPI_AC_STATUS_ONLINE: 169 - seq_puts(seq, "on-line\n"); 170 - break; 171 - default: 172 - seq_puts(seq, "unknown\n"); 173 - break; 174 - } 175 - 176 - return 0; 177 - } 178 - 179 - static int acpi_ac_add_fs(struct acpi_ac *ac) 180 - { 181 - struct proc_dir_entry *entry = NULL; 182 - 183 - printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded," 184 - " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); 185 - if (!acpi_device_dir(ac->device)) { 186 - acpi_device_dir(ac->device) = 187 - proc_mkdir(acpi_device_bid(ac->device), acpi_ac_dir); 188 - if (!acpi_device_dir(ac->device)) 189 - return -ENODEV; 190 - } 191 - 192 - /* 'state' [R] */ 193 - entry = proc_create_single_data(ACPI_AC_FILE_STATE, S_IRUGO, 194 - acpi_device_dir(ac->device), acpi_ac_seq_show, ac); 195 - if (!entry) 196 - return -ENODEV; 197 - return 0; 198 - } 199 - 200 - static int acpi_ac_remove_fs(struct acpi_ac *ac) 201 - { 202 - 203 - if (acpi_device_dir(ac->device)) { 204 - remove_proc_entry(ACPI_AC_FILE_STATE, 205 - acpi_device_dir(ac->device)); 206 - remove_proc_entry(acpi_device_bid(ac->device), acpi_ac_dir); 207 - acpi_device_dir(ac->device) = NULL; 208 - } 209 - 210 - return 0; 211 - } 212 - #endif 213 - 214 153 /* -------------------------------------------------------------------------- 215 154 Driver Model 216 155 -------------------------------------------------------------------------- */ ··· 155 236 default: 156 237 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 157 238 "Unsupported event [0x%x]\n", event)); 158 - /* fall through */ 239 + fallthrough; 159 240 case ACPI_AC_NOTIFY_STATUS: 160 241 case ACPI_NOTIFY_BUS_CHECK: 161 242 case ACPI_NOTIFY_DEVICE_CHECK: ··· 267 348 psy_cfg.drv_data = ac; 268 349 269 350 ac->charger_desc.name = acpi_device_bid(device); 270 - #ifdef CONFIG_ACPI_PROCFS_POWER 271 - result = acpi_ac_add_fs(ac); 272 - if (result) 273 - goto end; 274 - #endif 275 351 ac->charger_desc.type = POWER_SUPPLY_TYPE_MAINS; 276 352 ac->charger_desc.properties = ac_props; 277 353 ac->charger_desc.num_properties = ARRAY_SIZE(ac_props); ··· 286 372 register_acpi_notifier(&ac->battery_nb); 287 373 end: 288 374 if (result) { 289 - #ifdef CONFIG_ACPI_PROCFS_POWER 290 - acpi_ac_remove_fs(ac); 291 - #endif 292 375 kfree(ac); 293 376 } 294 377 ··· 329 418 power_supply_unregister(ac->charger); 330 419 unregister_acpi_notifier(&ac->battery_nb); 331 420 332 - #ifdef CONFIG_ACPI_PROCFS_POWER 333 - acpi_ac_remove_fs(ac); 334 - #endif 335 - 336 421 kfree(ac); 337 422 338 423 return 0; ··· 354 447 } 355 448 } 356 449 357 - #ifdef CONFIG_ACPI_PROCFS_POWER 358 - acpi_ac_dir = acpi_lock_ac_dir(); 359 - if (!acpi_ac_dir) 360 - return -ENODEV; 361 - #endif 362 - 363 - 364 450 result = acpi_bus_register_driver(&acpi_ac_driver); 365 451 if (result < 0) { 366 - #ifdef CONFIG_ACPI_PROCFS_POWER 367 - acpi_unlock_ac_dir(acpi_ac_dir); 368 - #endif 369 452 return -ENODEV; 370 453 } 371 454 ··· 365 468 static void __exit acpi_ac_exit(void) 366 469 { 367 470 acpi_bus_unregister_driver(&acpi_ac_driver); 368 - #ifdef CONFIG_ACPI_PROCFS_POWER 369 - acpi_unlock_ac_dir(acpi_ac_dir); 370 - #endif 371 471 } 372 472 module_init(acpi_ac_init); 373 473 module_exit(acpi_ac_exit);
+1 -1
drivers/acpi/acpi_pad.c
··· 88 88 cpumask_var_t tmp; 89 89 int cpu; 90 90 unsigned long min_weight = -1; 91 - unsigned long uninitialized_var(preferred_cpu); 91 + unsigned long preferred_cpu; 92 92 93 93 if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) 94 94 return;
+1 -1
drivers/acpi/acpi_processor.c
··· 79 79 * PIIX4 models. 80 80 */ 81 81 errata.piix4.throttle = 1; 82 - /* fall through*/ 82 + fallthrough; 83 83 84 84 case 2: /* PIIX4E */ 85 85 case 3: /* PIIX4M */
+8 -6
drivers/acpi/acpica/evrgnini.c
··· 38 38 union acpi_operand_object *region_desc = 39 39 (union acpi_operand_object *)handle; 40 40 struct acpi_mem_space_context *local_region_context; 41 + struct acpi_mem_mapping *mm; 41 42 42 43 ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); 43 44 ··· 47 46 local_region_context = 48 47 (struct acpi_mem_space_context *)*region_context; 49 48 50 - /* Delete a cached mapping if present */ 49 + /* Delete memory mappings if present */ 51 50 52 - if (local_region_context->mapped_length) { 53 - acpi_os_unmap_memory(local_region_context-> 54 - mapped_logical_address, 55 - local_region_context-> 56 - mapped_length); 51 + while (local_region_context->first_mm) { 52 + mm = local_region_context->first_mm; 53 + local_region_context->first_mm = mm->next_mm; 54 + acpi_os_unmap_memory(mm->logical_address, 55 + mm->length); 56 + ACPI_FREE(mm); 57 57 } 58 58 ACPI_FREE(local_region_context); 59 59 *region_context = NULL;
-4
drivers/acpi/acpica/exprep.c
··· 473 473 (u8)access_byte_width; 474 474 } 475 475 } 476 - /* An additional reference for the container */ 477 - 478 - acpi_ut_add_reference(obj_desc->field.region_obj); 479 - 480 476 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 481 477 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", 482 478 obj_desc->field.start_field_bit_offset,
+46 -18
drivers/acpi/acpica/exregion.c
··· 41 41 acpi_status status = AE_OK; 42 42 void *logical_addr_ptr = NULL; 43 43 struct acpi_mem_space_context *mem_info = region_context; 44 + struct acpi_mem_mapping *mm = mem_info->cur_mm; 44 45 u32 length; 45 46 acpi_size map_length; 46 47 acpi_size page_boundary_map_length; ··· 97 96 * Is 1) Address below the current mapping? OR 98 97 * 2) Address beyond the current mapping? 99 98 */ 100 - if ((address < mem_info->mapped_physical_address) || 101 - (((u64) address + length) > ((u64) 102 - mem_info->mapped_physical_address + 103 - mem_info->mapped_length))) { 99 + if (!mm || (address < mm->physical_address) || 100 + ((u64) address + length > (u64) mm->physical_address + mm->length)) { 104 101 /* 105 - * The request cannot be resolved by the current memory mapping; 106 - * Delete the existing mapping and create a new one. 102 + * The request cannot be resolved by the current memory mapping. 103 + * 104 + * Look for an existing saved mapping covering the address range 105 + * at hand. If found, save it as the current one and carry out 106 + * the access. 107 107 */ 108 - if (mem_info->mapped_length) { 108 + for (mm = mem_info->first_mm; mm; mm = mm->next_mm) { 109 + if (mm == mem_info->cur_mm) 110 + continue; 109 111 110 - /* Valid mapping, delete it */ 112 + if (address < mm->physical_address) 113 + continue; 111 114 112 - acpi_os_unmap_memory(mem_info->mapped_logical_address, 113 - mem_info->mapped_length); 115 + if ((u64) address + length > 116 + (u64) mm->physical_address + mm->length) 117 + continue; 118 + 119 + mem_info->cur_mm = mm; 120 + goto access; 121 + } 122 + 123 + /* Create a new mappings list entry */ 124 + mm = ACPI_ALLOCATE_ZEROED(sizeof(*mm)); 125 + if (!mm) { 126 + ACPI_ERROR((AE_INFO, 127 + "Unable to save memory mapping at 0x%8.8X%8.8X, size %u", 128 + ACPI_FORMAT_UINT64(address), length)); 129 + return_ACPI_STATUS(AE_NO_MEMORY); 114 130 } 115 131 116 132 /* ··· 161 143 162 144 /* Create a new mapping starting at the address given */ 163 145 164 - mem_info->mapped_logical_address = 165 - acpi_os_map_memory(address, map_length); 166 - if (!mem_info->mapped_logical_address) { 146 + logical_addr_ptr = acpi_os_map_memory(address, map_length); 147 + if (!logical_addr_ptr) { 167 148 ACPI_ERROR((AE_INFO, 168 149 "Could not map memory at 0x%8.8X%8.8X, size %u", 169 150 ACPI_FORMAT_UINT64(address), 170 151 (u32)map_length)); 171 - mem_info->mapped_length = 0; 152 + ACPI_FREE(mm); 172 153 return_ACPI_STATUS(AE_NO_MEMORY); 173 154 } 174 155 175 156 /* Save the physical address and mapping size */ 176 157 177 - mem_info->mapped_physical_address = address; 178 - mem_info->mapped_length = map_length; 158 + mm->logical_address = logical_addr_ptr; 159 + mm->physical_address = address; 160 + mm->length = map_length; 161 + 162 + /* 163 + * Add the new entry to the mappigs list and save it as the 164 + * current mapping. 165 + */ 166 + mm->next_mm = mem_info->first_mm; 167 + mem_info->first_mm = mm; 168 + 169 + mem_info->cur_mm = mm; 179 170 } 180 171 172 + access: 181 173 /* 182 174 * Generate a logical pointer corresponding to the address we want to 183 175 * access 184 176 */ 185 - logical_addr_ptr = mem_info->mapped_logical_address + 186 - ((u64) address - (u64) mem_info->mapped_physical_address); 177 + logical_addr_ptr = mm->logical_address + 178 + ((u64) address - (u64) mm->physical_address); 187 179 188 180 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 189 181 "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
+1 -5
drivers/acpi/acpica/utdelete.c
··· 568 568 next_object = object->buffer_field.buffer_obj; 569 569 break; 570 570 571 - case ACPI_TYPE_LOCAL_REGION_FIELD: 572 - 573 - next_object = object->field.region_obj; 574 - break; 575 - 576 571 case ACPI_TYPE_LOCAL_BANK_FIELD: 577 572 578 573 next_object = object->bank_field.bank_obj; ··· 608 613 } 609 614 break; 610 615 616 + case ACPI_TYPE_LOCAL_REGION_FIELD: 611 617 case ACPI_TYPE_REGION: 612 618 default: 613 619
+1 -2
drivers/acpi/acpica/utids.c
··· 263 263 * 3) Size of the actual CID strings 264 264 */ 265 265 cid_list_size = sizeof(struct acpi_pnp_device_id_list) + 266 - ((count - 1) * sizeof(struct acpi_pnp_device_id)) + 267 - string_area_size; 266 + (count * sizeof(struct acpi_pnp_device_id)) + string_area_size; 268 267 269 268 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size); 270 269 if (!cid_list) {
+1 -1
drivers/acpi/apei/hest.c
··· 227 227 void __init acpi_hest_init(void) 228 228 { 229 229 acpi_status status; 230 - int rc = -ENODEV; 230 + int rc; 231 231 unsigned int ghes_count = 0; 232 232 233 233 if (hest_disable) {
-255
drivers/acpi/battery.c
··· 24 24 25 25 #include <asm/unaligned.h> 26 26 27 - #ifdef CONFIG_ACPI_PROCFS_POWER 28 - #include <linux/proc_fs.h> 29 - #include <linux/seq_file.h> 30 - #include <linux/uaccess.h> 31 - #endif 32 - 33 27 #include <linux/acpi.h> 34 28 #include <linux/power_supply.h> 35 29 ··· 62 68 static unsigned int cache_time = 1000; 63 69 module_param(cache_time, uint, 0644); 64 70 MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 65 - 66 - #ifdef CONFIG_ACPI_PROCFS_POWER 67 - extern struct proc_dir_entry *acpi_lock_battery_dir(void); 68 - extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); 69 - #endif 70 71 71 72 static const struct acpi_device_id battery_device_ids[] = { 72 73 {"PNP0C0A", 0}, ··· 1013 1024 } 1014 1025 1015 1026 /* -------------------------------------------------------------------------- 1016 - FS Interface (/proc) 1017 - -------------------------------------------------------------------------- */ 1018 - 1019 - #ifdef CONFIG_ACPI_PROCFS_POWER 1020 - static struct proc_dir_entry *acpi_battery_dir; 1021 - 1022 - static const char *acpi_battery_units(const struct acpi_battery *battery) 1023 - { 1024 - return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ? 1025 - "mA" : "mW"; 1026 - } 1027 - 1028 - static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset) 1029 - { 1030 - struct acpi_battery *battery = seq->private; 1031 - int result = acpi_battery_update(battery, false); 1032 - 1033 - if (result) 1034 - goto end; 1035 - 1036 - seq_printf(seq, "present: %s\n", 1037 - acpi_battery_present(battery) ? "yes" : "no"); 1038 - if (!acpi_battery_present(battery)) 1039 - goto end; 1040 - if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) 1041 - seq_printf(seq, "design capacity: unknown\n"); 1042 - else 1043 - seq_printf(seq, "design capacity: %d %sh\n", 1044 - battery->design_capacity, 1045 - acpi_battery_units(battery)); 1046 - 1047 - if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN) 1048 - seq_printf(seq, "last full capacity: unknown\n"); 1049 - else 1050 - seq_printf(seq, "last full capacity: %d %sh\n", 1051 - battery->full_charge_capacity, 1052 - acpi_battery_units(battery)); 1053 - 1054 - seq_printf(seq, "battery technology: %srechargeable\n", 1055 - battery->technology ? "" : "non-"); 1056 - 1057 - if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN) 1058 - seq_printf(seq, "design voltage: unknown\n"); 1059 - else 1060 - seq_printf(seq, "design voltage: %d mV\n", 1061 - battery->design_voltage); 1062 - seq_printf(seq, "design capacity warning: %d %sh\n", 1063 - battery->design_capacity_warning, 1064 - acpi_battery_units(battery)); 1065 - seq_printf(seq, "design capacity low: %d %sh\n", 1066 - battery->design_capacity_low, 1067 - acpi_battery_units(battery)); 1068 - seq_printf(seq, "cycle count: %i\n", battery->cycle_count); 1069 - seq_printf(seq, "capacity granularity 1: %d %sh\n", 1070 - battery->capacity_granularity_1, 1071 - acpi_battery_units(battery)); 1072 - seq_printf(seq, "capacity granularity 2: %d %sh\n", 1073 - battery->capacity_granularity_2, 1074 - acpi_battery_units(battery)); 1075 - seq_printf(seq, "model number: %s\n", battery->model_number); 1076 - seq_printf(seq, "serial number: %s\n", battery->serial_number); 1077 - seq_printf(seq, "battery type: %s\n", battery->type); 1078 - seq_printf(seq, "OEM info: %s\n", battery->oem_info); 1079 - end: 1080 - if (result) 1081 - seq_printf(seq, "ERROR: Unable to read battery info\n"); 1082 - return result; 1083 - } 1084 - 1085 - static int acpi_battery_state_proc_show(struct seq_file *seq, void *offset) 1086 - { 1087 - struct acpi_battery *battery = seq->private; 1088 - int result = acpi_battery_update(battery, false); 1089 - 1090 - if (result) 1091 - goto end; 1092 - 1093 - seq_printf(seq, "present: %s\n", 1094 - acpi_battery_present(battery) ? "yes" : "no"); 1095 - if (!acpi_battery_present(battery)) 1096 - goto end; 1097 - 1098 - seq_printf(seq, "capacity state: %s\n", 1099 - (battery->state & 0x04) ? "critical" : "ok"); 1100 - if ((battery->state & 0x01) && (battery->state & 0x02)) 1101 - seq_printf(seq, 1102 - "charging state: charging/discharging\n"); 1103 - else if (battery->state & 0x01) 1104 - seq_printf(seq, "charging state: discharging\n"); 1105 - else if (battery->state & 0x02) 1106 - seq_printf(seq, "charging state: charging\n"); 1107 - else 1108 - seq_printf(seq, "charging state: charged\n"); 1109 - 1110 - if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) 1111 - seq_printf(seq, "present rate: unknown\n"); 1112 - else 1113 - seq_printf(seq, "present rate: %d %s\n", 1114 - battery->rate_now, acpi_battery_units(battery)); 1115 - 1116 - if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) 1117 - seq_printf(seq, "remaining capacity: unknown\n"); 1118 - else 1119 - seq_printf(seq, "remaining capacity: %d %sh\n", 1120 - battery->capacity_now, acpi_battery_units(battery)); 1121 - if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN) 1122 - seq_printf(seq, "present voltage: unknown\n"); 1123 - else 1124 - seq_printf(seq, "present voltage: %d mV\n", 1125 - battery->voltage_now); 1126 - end: 1127 - if (result) 1128 - seq_printf(seq, "ERROR: Unable to read battery state\n"); 1129 - 1130 - return result; 1131 - } 1132 - 1133 - static int acpi_battery_alarm_proc_show(struct seq_file *seq, void *offset) 1134 - { 1135 - struct acpi_battery *battery = seq->private; 1136 - int result = acpi_battery_update(battery, false); 1137 - 1138 - if (result) 1139 - goto end; 1140 - 1141 - if (!acpi_battery_present(battery)) { 1142 - seq_printf(seq, "present: no\n"); 1143 - goto end; 1144 - } 1145 - seq_printf(seq, "alarm: "); 1146 - if (battery->alarm) { 1147 - seq_printf(seq, "%u %sh\n", battery->alarm, 1148 - acpi_battery_units(battery)); 1149 - } else { 1150 - seq_printf(seq, "unsupported\n"); 1151 - } 1152 - end: 1153 - if (result) 1154 - seq_printf(seq, "ERROR: Unable to read battery alarm\n"); 1155 - return result; 1156 - } 1157 - 1158 - static ssize_t acpi_battery_write_alarm(struct file *file, 1159 - const char __user * buffer, 1160 - size_t count, loff_t * ppos) 1161 - { 1162 - int result = 0; 1163 - char alarm_string[12] = { '\0' }; 1164 - struct seq_file *m = file->private_data; 1165 - struct acpi_battery *battery = m->private; 1166 - 1167 - if (!battery || (count > sizeof(alarm_string) - 1)) 1168 - return -EINVAL; 1169 - if (!acpi_battery_present(battery)) { 1170 - result = -ENODEV; 1171 - goto end; 1172 - } 1173 - if (copy_from_user(alarm_string, buffer, count)) { 1174 - result = -EFAULT; 1175 - goto end; 1176 - } 1177 - alarm_string[count] = '\0'; 1178 - if (kstrtoint(alarm_string, 0, &battery->alarm)) { 1179 - result = -EINVAL; 1180 - goto end; 1181 - } 1182 - result = acpi_battery_set_alarm(battery); 1183 - end: 1184 - if (result) 1185 - return result; 1186 - return count; 1187 - } 1188 - 1189 - static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file) 1190 - { 1191 - return single_open(file, acpi_battery_alarm_proc_show, PDE_DATA(inode)); 1192 - } 1193 - 1194 - static const struct proc_ops acpi_battery_alarm_proc_ops = { 1195 - .proc_open = acpi_battery_alarm_proc_open, 1196 - .proc_read = seq_read, 1197 - .proc_write = acpi_battery_write_alarm, 1198 - .proc_lseek = seq_lseek, 1199 - .proc_release = single_release, 1200 - }; 1201 - 1202 - static int acpi_battery_add_fs(struct acpi_device *device) 1203 - { 1204 - pr_warn(PREFIX "Deprecated procfs I/F for battery is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); 1205 - if (!acpi_device_dir(device)) { 1206 - acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 1207 - acpi_battery_dir); 1208 - if (!acpi_device_dir(device)) 1209 - return -ENODEV; 1210 - } 1211 - 1212 - if (!proc_create_single_data("info", S_IRUGO, acpi_device_dir(device), 1213 - acpi_battery_info_proc_show, acpi_driver_data(device))) 1214 - return -ENODEV; 1215 - if (!proc_create_single_data("state", S_IRUGO, acpi_device_dir(device), 1216 - acpi_battery_state_proc_show, acpi_driver_data(device))) 1217 - return -ENODEV; 1218 - if (!proc_create_data("alarm", S_IFREG | S_IRUGO | S_IWUSR, 1219 - acpi_device_dir(device), &acpi_battery_alarm_proc_ops, 1220 - acpi_driver_data(device))) 1221 - return -ENODEV; 1222 - return 0; 1223 - } 1224 - 1225 - static void acpi_battery_remove_fs(struct acpi_device *device) 1226 - { 1227 - if (!acpi_device_dir(device)) 1228 - return; 1229 - remove_proc_subtree(acpi_device_bid(device), acpi_battery_dir); 1230 - acpi_device_dir(device) = NULL; 1231 - } 1232 - 1233 - #endif 1234 - 1235 - /* -------------------------------------------------------------------------- 1236 1027 Driver Interface 1237 1028 -------------------------------------------------------------------------- */ 1238 1029 ··· 1201 1432 if (result) 1202 1433 goto fail; 1203 1434 1204 - #ifdef CONFIG_ACPI_PROCFS_POWER 1205 - result = acpi_battery_add_fs(device); 1206 - if (result) { 1207 - acpi_battery_remove_fs(device); 1208 - goto fail; 1209 - } 1210 - #endif 1211 - 1212 1435 pr_info(PREFIX "%s Slot [%s] (battery %s)\n", 1213 1436 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 1214 1437 device->status.battery_present ? "present" : "absent"); ··· 1229 1468 device_init_wakeup(&device->dev, 0); 1230 1469 battery = acpi_driver_data(device); 1231 1470 unregister_pm_notifier(&battery->pm_nb); 1232 - #ifdef CONFIG_ACPI_PROCFS_POWER 1233 - acpi_battery_remove_fs(device); 1234 - #endif 1235 1471 sysfs_remove_battery(battery); 1236 1472 mutex_destroy(&battery->lock); 1237 1473 mutex_destroy(&battery->sysfs_lock); ··· 1289 1531 } 1290 1532 } 1291 1533 1292 - #ifdef CONFIG_ACPI_PROCFS_POWER 1293 - acpi_battery_dir = acpi_lock_battery_dir(); 1294 - if (!acpi_battery_dir) 1295 - return; 1296 - #endif 1297 1534 result = acpi_bus_register_driver(&acpi_battery_driver); 1298 - #ifdef CONFIG_ACPI_PROCFS_POWER 1299 - if (result < 0) 1300 - acpi_unlock_battery_dir(acpi_battery_dir); 1301 - #endif 1302 1535 battery_driver_registered = (result == 0); 1303 1536 } 1304 1537 ··· 1309 1560 acpi_bus_unregister_driver(&acpi_battery_driver); 1310 1561 battery_hook_exit(); 1311 1562 } 1312 - #ifdef CONFIG_ACPI_PROCFS_POWER 1313 - if (acpi_battery_dir) 1314 - acpi_unlock_battery_dir(acpi_battery_dir); 1315 - #endif 1316 1563 } 1317 1564 1318 1565 module_init(acpi_battery_init);
+1 -1
drivers/acpi/button.c
··· 405 405 switch (event) { 406 406 case ACPI_FIXED_HARDWARE_EVENT: 407 407 event = ACPI_BUTTON_NOTIFY_STATUS; 408 - /* fall through */ 408 + fallthrough; 409 409 case ACPI_BUTTON_NOTIFY_STATUS: 410 410 input = button->input; 411 411 if (button->type == ACPI_BUTTON_TYPE_LID) {
-87
drivers/acpi/cm_sbs.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - 3 - #include <linux/kernel.h> 4 - #include <linux/module.h> 5 - #include <linux/init.h> 6 - #include <linux/acpi.h> 7 - #include <linux/types.h> 8 - #include <linux/proc_fs.h> 9 - #include <linux/seq_file.h> 10 - #include <acpi/acpi_bus.h> 11 - #include <acpi/acpi_drivers.h> 12 - 13 - #define PREFIX "ACPI: " 14 - 15 - ACPI_MODULE_NAME("cm_sbs"); 16 - #define ACPI_AC_CLASS "ac_adapter" 17 - #define ACPI_BATTERY_CLASS "battery" 18 - #define _COMPONENT ACPI_SBS_COMPONENT 19 - static struct proc_dir_entry *acpi_ac_dir; 20 - static struct proc_dir_entry *acpi_battery_dir; 21 - 22 - static DEFINE_MUTEX(cm_sbs_mutex); 23 - 24 - static int lock_ac_dir_cnt; 25 - static int lock_battery_dir_cnt; 26 - 27 - struct proc_dir_entry *acpi_lock_ac_dir(void) 28 - { 29 - mutex_lock(&cm_sbs_mutex); 30 - if (!acpi_ac_dir) 31 - acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); 32 - if (acpi_ac_dir) { 33 - lock_ac_dir_cnt++; 34 - } else { 35 - printk(KERN_ERR PREFIX 36 - "Cannot create %s\n", ACPI_AC_CLASS); 37 - } 38 - mutex_unlock(&cm_sbs_mutex); 39 - return acpi_ac_dir; 40 - } 41 - EXPORT_SYMBOL(acpi_lock_ac_dir); 42 - 43 - void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param) 44 - { 45 - mutex_lock(&cm_sbs_mutex); 46 - if (acpi_ac_dir_param) 47 - lock_ac_dir_cnt--; 48 - if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) { 49 - remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); 50 - acpi_ac_dir = NULL; 51 - } 52 - mutex_unlock(&cm_sbs_mutex); 53 - } 54 - EXPORT_SYMBOL(acpi_unlock_ac_dir); 55 - 56 - struct proc_dir_entry *acpi_lock_battery_dir(void) 57 - { 58 - mutex_lock(&cm_sbs_mutex); 59 - if (!acpi_battery_dir) { 60 - acpi_battery_dir = 61 - proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); 62 - } 63 - if (acpi_battery_dir) { 64 - lock_battery_dir_cnt++; 65 - } else { 66 - printk(KERN_ERR PREFIX 67 - "Cannot create %s\n", ACPI_BATTERY_CLASS); 68 - } 69 - mutex_unlock(&cm_sbs_mutex); 70 - return acpi_battery_dir; 71 - } 72 - EXPORT_SYMBOL(acpi_lock_battery_dir); 73 - 74 - void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) 75 - { 76 - mutex_lock(&cm_sbs_mutex); 77 - if (acpi_battery_dir_param) 78 - lock_battery_dir_cnt--; 79 - if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param 80 - && acpi_battery_dir) { 81 - remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); 82 - acpi_battery_dir = NULL; 83 - } 84 - mutex_unlock(&cm_sbs_mutex); 85 - return; 86 - } 87 - EXPORT_SYMBOL(acpi_unlock_battery_dir);
+1 -1
drivers/acpi/dock.c
··· 469 469 surprise_removal = 1; 470 470 event = ACPI_NOTIFY_EJECT_REQUEST; 471 471 /* Fall back */ 472 - /* fall through */ 472 + fallthrough; 473 473 case ACPI_NOTIFY_EJECT_REQUEST: 474 474 begin_undock(ds); 475 475 if ((immediate_undock && !(ds->flags & DOCK_IS_ATA))
+4 -4
drivers/acpi/ec.c
··· 2059 2059 { 2060 2060 switch (ec_event_clearing) { 2061 2061 case ACPI_EC_EVT_TIMING_STATUS: 2062 - return sprintf(buffer, "status"); 2062 + return sprintf(buffer, "status\n"); 2063 2063 case ACPI_EC_EVT_TIMING_QUERY: 2064 - return sprintf(buffer, "query"); 2064 + return sprintf(buffer, "query\n"); 2065 2065 case ACPI_EC_EVT_TIMING_EVENT: 2066 - return sprintf(buffer, "event"); 2066 + return sprintf(buffer, "event\n"); 2067 2067 default: 2068 - return sprintf(buffer, "invalid"); 2068 + return sprintf(buffer, "invalid\n"); 2069 2069 } 2070 2070 return 0; 2071 2071 }
+1 -1
drivers/acpi/evged.c
··· 106 106 107 107 if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle))) 108 108 break; 109 - /* fall through */ 109 + fallthrough; 110 110 default: 111 111 if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle))) 112 112 break;
+1 -1
drivers/acpi/nfit/nfit.h
··· 16 16 /* ACPI 6.1 */ 17 17 #define UUID_NFIT_BUS "2f10e7a4-9e91-11e4-89d3-123b93f75cba" 18 18 19 - /* http://pmem.io/documents/NVDIMM_DSM_Interface-V1.6.pdf */ 19 + /* https://pmem.io/documents/NVDIMM_DSM_Interface-V1.6.pdf */ 20 20 #define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66" 21 21 22 22 /* https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/ */
+1 -9
drivers/acpi/numa/srat.c
··· 230 230 pxm &= 0xff; 231 231 232 232 node = acpi_map_pxm_to_node(pxm); 233 - if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { 233 + if (node == NUMA_NO_NODE) { 234 234 pr_err("SRAT: Too many proximity domains.\n"); 235 235 goto out_err_bad_srat; 236 236 } ··· 291 291 struct acpi_srat_x2apic_cpu_affinity *processor_affinity; 292 292 293 293 processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header; 294 - if (!processor_affinity) 295 - return -EINVAL; 296 294 297 295 acpi_table_print_srat_entry(&header->common); 298 296 ··· 307 309 struct acpi_srat_cpu_affinity *processor_affinity; 308 310 309 311 processor_affinity = (struct acpi_srat_cpu_affinity *)header; 310 - if (!processor_affinity) 311 - return -EINVAL; 312 312 313 313 acpi_table_print_srat_entry(&header->common); 314 314 ··· 323 327 struct acpi_srat_gicc_affinity *processor_affinity; 324 328 325 329 processor_affinity = (struct acpi_srat_gicc_affinity *)header; 326 - if (!processor_affinity) 327 - return -EINVAL; 328 330 329 331 acpi_table_print_srat_entry(&header->common); 330 332 ··· 341 347 struct acpi_srat_mem_affinity *memory_affinity; 342 348 343 349 memory_affinity = (struct acpi_srat_mem_affinity *)header; 344 - if (!memory_affinity) 345 - return -EINVAL; 346 350 347 351 acpi_table_print_srat_entry(&header->common); 348 352
+37 -28
drivers/acpi/osl.c
··· 77 77 void __iomem *virt; 78 78 acpi_physical_address phys; 79 79 acpi_size size; 80 - unsigned long refcount; 80 + union { 81 + unsigned long refcount; 82 + struct rcu_work rwork; 83 + } track; 81 84 }; 82 85 83 86 static LIST_HEAD(acpi_ioremaps); ··· 253 250 map = acpi_map_lookup(phys, size); 254 251 if (map) { 255 252 virt = map->virt + (phys - map->phys); 256 - map->refcount++; 253 + map->track.refcount++; 257 254 } 258 255 mutex_unlock(&acpi_ioremap_lock); 259 256 return virt; ··· 338 335 /* Check if there's a suitable mapping already. */ 339 336 map = acpi_map_lookup(phys, size); 340 337 if (map) { 341 - map->refcount++; 338 + map->track.refcount++; 342 339 goto out; 343 340 } 344 341 ··· 361 358 map->virt = virt; 362 359 map->phys = pg_off; 363 360 map->size = pg_sz; 364 - map->refcount = 1; 361 + map->track.refcount = 1; 365 362 366 363 list_add_tail_rcu(&map->list, &acpi_ioremaps); 367 364 ··· 377 374 } 378 375 EXPORT_SYMBOL_GPL(acpi_os_map_memory); 379 376 380 - /* Must be called with mutex_lock(&acpi_ioremap_lock) */ 381 - static unsigned long acpi_os_drop_map_ref(struct acpi_ioremap *map) 377 + static void acpi_os_map_remove(struct work_struct *work) 382 378 { 383 - unsigned long refcount = --map->refcount; 379 + struct acpi_ioremap *map = container_of(to_rcu_work(work), 380 + struct acpi_ioremap, 381 + track.rwork); 384 382 385 - if (!refcount) 386 - list_del_rcu(&map->list); 387 - return refcount; 388 - } 389 - 390 - static void acpi_os_map_cleanup(struct acpi_ioremap *map) 391 - { 392 - synchronize_rcu_expedited(); 393 383 acpi_unmap(map->phys, map->virt); 394 384 kfree(map); 385 + } 386 + 387 + /* Must be called with mutex_lock(&acpi_ioremap_lock) */ 388 + static void acpi_os_drop_map_ref(struct acpi_ioremap *map) 389 + { 390 + if (--map->track.refcount) 391 + return; 392 + 393 + list_del_rcu(&map->list); 394 + 395 + INIT_RCU_WORK(&map->track.rwork, acpi_os_map_remove); 396 + queue_rcu_work(system_wq, &map->track.rwork); 395 397 } 396 398 397 399 /** ··· 405 397 * @size: Size of the address range to drop a reference to. 406 398 * 407 399 * Look up the given virtual address range in the list of existing ACPI memory 408 - * mappings, drop a reference to it and unmap it if there are no more active 409 - * references to it. 400 + * mappings, drop a reference to it and if there are no more active references 401 + * to it, queue it up for later removal. 410 402 * 411 403 * During early init (when acpi_permanent_mmap has not been set yet) this 412 404 * routine simply calls __acpi_unmap_table() to get the job done. Since ··· 416 408 void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) 417 409 { 418 410 struct acpi_ioremap *map; 419 - unsigned long refcount; 420 411 421 412 if (!acpi_permanent_mmap) { 422 413 __acpi_unmap_table(virt, size); ··· 423 416 } 424 417 425 418 mutex_lock(&acpi_ioremap_lock); 419 + 426 420 map = acpi_map_lookup_virt(virt, size); 427 421 if (!map) { 428 422 mutex_unlock(&acpi_ioremap_lock); 429 423 WARN(true, PREFIX "%s: bad address %p\n", __func__, virt); 430 424 return; 431 425 } 432 - refcount = acpi_os_drop_map_ref(map); 433 - mutex_unlock(&acpi_ioremap_lock); 426 + acpi_os_drop_map_ref(map); 434 427 435 - if (!refcount) 436 - acpi_os_map_cleanup(map); 428 + mutex_unlock(&acpi_ioremap_lock); 437 429 } 438 430 EXPORT_SYMBOL_GPL(acpi_os_unmap_iomem); 439 431 432 + /** 433 + * acpi_os_unmap_memory - Drop a memory mapping reference. 434 + * @virt: Start of the address range to drop a reference to. 435 + * @size: Size of the address range to drop a reference to. 436 + */ 440 437 void __ref acpi_os_unmap_memory(void *virt, acpi_size size) 441 438 { 442 - return acpi_os_unmap_iomem((void __iomem *)virt, size); 439 + acpi_os_unmap_iomem((void __iomem *)virt, size); 443 440 } 444 441 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); 445 442 ··· 472 461 { 473 462 u64 addr; 474 463 struct acpi_ioremap *map; 475 - unsigned long refcount; 476 464 477 465 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) 478 466 return; ··· 482 472 return; 483 473 484 474 mutex_lock(&acpi_ioremap_lock); 475 + 485 476 map = acpi_map_lookup(addr, gas->bit_width / 8); 486 477 if (!map) { 487 478 mutex_unlock(&acpi_ioremap_lock); 488 479 return; 489 480 } 490 - refcount = acpi_os_drop_map_ref(map); 491 - mutex_unlock(&acpi_ioremap_lock); 481 + acpi_os_drop_map_ref(map); 492 482 493 - if (!refcount) 494 - acpi_os_map_cleanup(map); 483 + mutex_unlock(&acpi_ioremap_lock); 495 484 } 496 485 EXPORT_SYMBOL(acpi_os_unmap_generic_address); 497 486
+1 -2
drivers/acpi/processor_idle.c
··· 203 203 */ 204 204 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 205 205 return; 206 - 207 - /*FALL THROUGH*/ 206 + fallthrough; 208 207 default: 209 208 /* TSC could halt in idle, so notify users */ 210 209 if (state > ACPI_STATE_C1)
+2 -12
drivers/acpi/property.c
··· 606 606 acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode, 607 607 const char *childname) 608 608 { 609 - char name[ACPI_PATH_SEGMENT_LENGTH]; 610 609 struct fwnode_handle *child; 611 - struct acpi_buffer path; 612 - acpi_status status; 613 - 614 - path.length = sizeof(name); 615 - path.pointer = name; 616 610 617 611 fwnode_for_each_child_node(fwnode, child) { 618 612 if (is_acpi_data_node(child)) { ··· 615 621 continue; 616 622 } 617 623 618 - status = acpi_get_name(ACPI_HANDLE_FWNODE(child), 619 - ACPI_SINGLE_NAME, &path); 620 - if (ACPI_FAILURE(status)) 621 - break; 622 - 623 - if (!strncmp(name, childname, ACPI_NAMESEG_SIZE)) 624 + if (!strncmp(acpi_device_bid(to_acpi_device_node(child)), 625 + childname, ACPI_NAMESEG_SIZE)) 624 626 return child; 625 627 } 626 628
+1 -1
drivers/acpi/resource.c
··· 373 373 case ACPI_ACTIVE_BOTH: 374 374 if (triggering == ACPI_EDGE_SENSITIVE) 375 375 return IRQ_TYPE_EDGE_BOTH; 376 - /* fall through */ 376 + fallthrough; 377 377 default: 378 378 return IRQ_TYPE_NONE; 379 379 }
+2 -2
drivers/acpi/spcr.c
··· 111 111 table->serial_port.access_width))) { 112 112 default: 113 113 pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); 114 - /* fall through */ 114 + fallthrough; 115 115 case 8: 116 116 iotype = "mmio"; 117 117 break; ··· 128 128 switch (table->interface_type) { 129 129 case ACPI_DBG2_ARM_SBSA_32BIT: 130 130 iotype = "mmio32"; 131 - /* fall through */ 131 + fallthrough; 132 132 case ACPI_DBG2_ARM_PL011: 133 133 case ACPI_DBG2_ARM_SBSA_GENERIC: 134 134 case ACPI_DBG2_BCM2835:
+6 -6
drivers/acpi/sysfs.c
··· 214 214 215 215 static int param_get_trace_method_name(char *buffer, const struct kernel_param *kp) 216 216 { 217 - return scnprintf(buffer, PAGE_SIZE, "%s", acpi_gbl_trace_method_name); 217 + return scnprintf(buffer, PAGE_SIZE, "%s\n", acpi_gbl_trace_method_name); 218 218 } 219 219 220 220 static const struct kernel_param_ops param_ops_trace_method = { ··· 271 271 static int param_get_trace_state(char *buffer, const struct kernel_param *kp) 272 272 { 273 273 if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED)) 274 - return sprintf(buffer, "disable"); 274 + return sprintf(buffer, "disable\n"); 275 275 else { 276 276 if (acpi_gbl_trace_method_name) { 277 277 if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) 278 - return sprintf(buffer, "method-once"); 278 + return sprintf(buffer, "method-once\n"); 279 279 else 280 - return sprintf(buffer, "method"); 280 + return sprintf(buffer, "method\n"); 281 281 } else 282 - return sprintf(buffer, "enable"); 282 + return sprintf(buffer, "enable\n"); 283 283 } 284 284 return 0; 285 285 } ··· 302 302 { 303 303 int result; 304 304 305 - result = sprintf(buffer, "%x", ACPI_CA_VERSION); 305 + result = sprintf(buffer, "%x\n", ACPI_CA_VERSION); 306 306 307 307 return result; 308 308 }
+7 -18
drivers/acpi/tables.c
··· 292 292 int errs = 0; 293 293 int i; 294 294 295 - if (acpi_disabled) 296 - return -ENODEV; 297 - 298 - if (!id) 299 - return -EINVAL; 300 - 301 - if (!table_size) 302 - return -EINVAL; 303 - 304 - if (!table_header) { 305 - pr_warn("%4.4s not present\n", id); 306 - return -ENODEV; 307 - } 308 - 309 295 table_end = (unsigned long)table_header + table_header->length; 310 296 311 297 /* Parse all entries looking for a match. */ ··· 355 369 return -ENODEV; 356 370 357 371 if (!id) 372 + return -EINVAL; 373 + 374 + if (!table_size) 358 375 return -EINVAL; 359 376 360 377 if (!strncmp(id, ACPI_SIG_MADT, 4)) ··· 479 490 } 480 491 481 492 /* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */ 482 - static const char * const table_sigs[] = { 493 + static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst = { 483 494 ACPI_SIG_BERT, ACPI_SIG_BGRT, ACPI_SIG_CPEP, ACPI_SIG_ECDT, 484 495 ACPI_SIG_EINJ, ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT, 485 496 ACPI_SIG_MSCT, ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT, ··· 490 501 ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, 491 502 ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, 492 503 ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT, 493 - ACPI_SIG_NHLT, NULL }; 504 + ACPI_SIG_NHLT }; 494 505 495 506 #define ACPI_HEADER_SIZE sizeof(struct acpi_table_header) 496 507 ··· 537 548 538 549 table = file.data; 539 550 540 - for (sig = 0; table_sigs[sig]; sig++) 551 + for (sig = 0; sig < ARRAY_SIZE(table_sigs); sig++) 541 552 if (!memcmp(table->signature, table_sigs[sig], 4)) 542 553 break; 543 554 544 - if (!table_sigs[sig]) { 555 + if (sig >= ARRAY_SIZE(table_sigs)) { 545 556 pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n", 546 557 cpio_path, file.name); 547 558 continue;
+11 -3
drivers/pci/hotplug/acpiphp_glue.c
··· 122 122 struct acpiphp_context *context; 123 123 124 124 acpi_lock_hp_context(); 125 + 125 126 context = acpiphp_get_context(adev); 126 - if (!context || context->func.parent->is_going_away) { 127 - acpi_unlock_hp_context(); 128 - return NULL; 127 + if (!context) 128 + goto unlock; 129 + 130 + if (context->func.parent->is_going_away) { 131 + acpiphp_put_context(context); 132 + context = NULL; 133 + goto unlock; 129 134 } 135 + 130 136 get_bridge(context->func.parent); 131 137 acpiphp_put_context(context); 138 + 139 + unlock: 132 140 acpi_unlock_hp_context(); 133 141 return context; 134 142 }
+3 -3
drivers/pci/pci-acpi.c
··· 527 527 return; 528 528 529 529 break; 530 - case HPX_CFG_VEND_CAP: /* Fall through */ 531 - case HPX_CFG_DVSEC: /* Fall through */ 530 + case HPX_CFG_VEND_CAP: 531 + case HPX_CFG_DVSEC: 532 532 default: 533 533 pci_warn(dev, "Encountered _HPX type 3 with unsupported config space location"); 534 534 return; ··· 1001 1001 error = -EBUSY; 1002 1002 break; 1003 1003 } 1004 - /* Fall through */ 1004 + fallthrough; 1005 1005 case PCI_D0: 1006 1006 case PCI_D1: 1007 1007 case PCI_D2:
+1 -1
include/acpi/acpixf.h
··· 12 12 13 13 /* Current ACPICA subsystem version in YYYYMMDD format */ 14 14 15 - #define ACPI_CA_VERSION 0x20200528 15 + #define ACPI_CA_VERSION 0x20200717 16 16 17 17 #include <acpi/acconfig.h> 18 18 #include <acpi/actypes.h>
+10 -4
include/acpi/actypes.h
··· 1146 1146 struct acpi_pnp_device_id_list { 1147 1147 u32 count; /* Number of IDs in Ids array */ 1148 1148 u32 list_size; /* Size of list, including ID strings */ 1149 - struct acpi_pnp_device_id ids[1]; /* ID array */ 1149 + struct acpi_pnp_device_id ids[]; /* ID array */ 1150 1150 }; 1151 1151 1152 1152 /* ··· 1201 1201 u16 function; 1202 1202 }; 1203 1203 1204 + struct acpi_mem_mapping { 1205 + acpi_physical_address physical_address; 1206 + u8 *logical_address; 1207 + acpi_size length; 1208 + struct acpi_mem_mapping *next_mm; 1209 + }; 1210 + 1204 1211 struct acpi_mem_space_context { 1205 1212 u32 length; 1206 1213 acpi_physical_address address; 1207 - acpi_physical_address mapped_physical_address; 1208 - u8 *mapped_logical_address; 1209 - acpi_size mapped_length; 1214 + struct acpi_mem_mapping *cur_mm; 1215 + struct acpi_mem_mapping *first_mm; 1210 1216 }; 1211 1217 1212 1218 /*
+1 -1
include/linux/tboot.h
··· 44 44 45 45 /* 46 46 * combines Sx info from FADT and FACS tables per ACPI 2.0+ spec 47 - * (http://www.acpi.info/) 47 + * (https://uefi.org/specifications) 48 48 */ 49 49 struct tboot_acpi_sleep_info { 50 50 struct tboot_acpi_generic_address pm1a_cnt_blk;
+1 -1
tools/power/cpupower/man/cpupower-idle-info.1
··· 75 75 other cores is described in the cpupower(1) manpage in the \-\-cpu option 76 76 section. 77 77 .SH REFERENCES 78 - http://www.acpi.info/spec.htm 78 + https://uefi.org/specifications 79 79 .SH "FILES" 80 80 .nf 81 81 \fI/sys/devices/system/cpu/cpu*/cpuidle/state*\fP