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

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

Pull ACPI updates from Rafael Wysocki:
"ACPI and PNP updates for 6.1-rc1.

These rearrange the ACPI device object initialization code (to get rid
of a redundant parent pointer from struct acpi_device among other
things), unify the _UID handling, drop support for some _OSI strings
that should not be necessary any more, add new IDs to support more
hardware and some more quirks, fix a few issues and clean up code all
over.

Specifics:

- Reimplement acpi_get_pci_dev() using the list of physical devices
associated with the given ACPI device object (Rafael Wysocki)

- Rename ACPI device object reference counting functions (Rafael
Wysocki)

- Rearrange ACPI device object initialization code (Rafael Wysocki)

- Drop parent field from struct acpi_device (Rafael Wysocki)

- Extend the the int3472-tps68470 driver to support multiple
consumers of a single TPS68470 along with the requisite
framework-level support (Daniel Scally)

- Filter out non-memory resources in is_memory(), add a helper
function to find all memory type resources of an ACPI device object
and use that function in 3 places (Heikki Krogerus)

- Add IRQ override quirks for Asus Vivobook K3402ZA/K3502ZA and ASUS
model S5402ZA (Tamim Khan, Kellen Renshaw)

- Fix acpi_dev_state_d0() kerneldoc (Sakari Ailus)

- Fix up suspend-to-idle support on ASUS Rembrandt laptops (Mario
Limonciello)

- Clean up ACPI platform devices support code (Andy Shevchenko, John
Garry)

- Clean up ACPI bus management code (Andy Shevchenko, ye xingchen)

- Add support for multiple DMA windows with different offsets to the
ACPI device enumeration code and use it on LoongArch (Jianmin Lv)

- Clean up the ACPI LPSS (Intel SoC) driver (Andy Shevchenko)

- Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable (Mario
Limonciello)

- Drop unused dev_fmt() and redundant 'HMAT' prefix from the HMAT
parsing code (Liu Shixin)

- Make ACPI FPDT parsing code avoid calling acpi_os_map_memory() on
invalid physical addresses (Hans de Goede)

- Silence missing-declarations warning related to Apple device
properties management (Lukas Wunner)

- Disable frequency invariance in the CPPC library if registers used
by cppc_get_perf_ctrs() are accessed via PCC (Jeremy Linton)

- Add ACPI disabled check to acpi_cpc_valid() (Perry Yuan)

- Fix Tx acknowledge in the PCC address space handler (Huisong Li)

- Use wait_for_completion_timeout() for PCC mailbox operations
(Huisong Li)

- Release resources on PCC address space setup failure path (Rafael
Mendonca)

- Remove unneeded result variables from APEI code (ye xingchen)

- Print total number of records found during BERT log parsing (Dmitry
Monakhov)

- Drop support for 3 _OSI strings that should not be necessary any
more and update documentation on custom _OSI strings so that adding
new ones is not encouraged any more (Mario Limonciello)

- Drop unneeded result variable from ec_write() (ye xingchen)

- Remove the leftover struct acpi_ac_bl from the ACPI AC driver
(Hanjun Guo)

- Reorder symbols to get rid of a few forward declarations in the
ACPI fan driver (Uwe Kleine-König)

- Add Toshiba Satellite/Portege Z830 ACPI backlight quirk (Arvid
Norlander)

- Add ARM DMA-330 controller to the supported list in the ACPI AMBA
driver (Vijayenthiran Subramaniam)

- Drop references to non-functional 01.org/linux-acpi web site from
MAINTAINERS and Kconfig help texts (Rafael Wysocki)

- Replace strlcpy() with unused retval with strscpy() in the ACPI
support code (Wolfram Sang)

- Do not initialize ret in main() in the pfrut utility (Shi junming)

- Drop useless ACPI DSDT override documentation (Rafael Wysocki)

- Fix a few typos and wording mistakes in the ACPI device enumeration
documentation (Jean Delvare)

- Introduce acpi_dev_uid_to_integer() to convert a _UID string into
an integer value (Andy Shevchenko)

- Use acpi_dev_uid_to_integer() in several places to unify _UID
handling (Andy Shevchenko)

- Drop unused pnpid32_to_pnpid() declaration from PNP code (Gaosheng
Cui)"

* tag 'acpi-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (79 commits)
ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device()
ACPI: LPSS: Replace loop with first entry retrieval
ACPI: x86: s2idle: Add another ID to s2idle_dmi_table
ACPI: x86: s2idle: Fix a NULL pointer dereference
MAINTAINERS: Drop records pointing to 01.org/linux-acpi
ACPI: Kconfig: Drop link to https://01.org/linux-acpi
ACPI: docs: Drop useless DSDT override documentation
ACPI: DPTF: Drop stale link from Kconfig help
ACPI: x86: s2idle: Add a quirk for ASUSTeK COMPUTER INC. ROG Flow X13
ACPI: x86: s2idle: Add a quirk for Lenovo Slim 7 Pro 14ARH7
ACPI: x86: s2idle: Add a quirk for ASUS ROG Zephyrus G14
ACPI: x86: s2idle: Add a quirk for ASUS TUF Gaming A17 FA707RE
ACPI: x86: s2idle: Add module parameter to prefer Microsoft GUID
ACPI: x86: s2idle: If a new AMD _HID is missing assume Rembrandt
ACPI: x86: s2idle: Move _HID handling for AMD systems into structures
platform/x86: int3472: Add board data for Surface Go2 IR camera
platform/x86: int3472: Support multiple gpio lookups in board data
platform/x86: int3472: Support multiple clock consumers
ACPI: bus: Add iterator for dependent devices
ACPI: scan: Add acpi_dev_get_next_consumer_dev()
...

+905 -604
-13
Documentation/admin-guide/acpi/dsdt-override.rst
··· 1 - .. SPDX-License-Identifier: GPL-2.0 2 - 3 - =============== 4 - Overriding DSDT 5 - =============== 6 - 7 - Linux supports a method of overriding the BIOS DSDT: 8 - 9 - CONFIG_ACPI_CUSTOM_DSDT - builds the image into the kernel. 10 - 11 - When to use this method is described in detail on the 12 - Linux/ACPI home page: 13 - https://01.org/linux-acpi/documentation/overriding-dsdt
+8 -8
Documentation/firmware-guide/acpi/enumeration.rst
··· 21 21 - Devices behind real busses where there is a connector resource 22 22 are represented as struct spi_device or struct i2c_device. Note 23 23 that standard UARTs are not busses so there is no struct uart_device, 24 - although some of them may be represented by sturct serdev_device. 24 + although some of them may be represented by struct serdev_device. 25 25 26 26 As both ACPI and Device Tree represent a tree of devices (and their 27 27 resources) this implementation follows the Device Tree way as much as ··· 205 205 } 206 206 ... 207 207 208 - The SPI device drivers only need to add ACPI IDs in a similar way than with 208 + The SPI device drivers only need to add ACPI IDs in a similar way to 209 209 the platform device drivers. Below is an example where we add ACPI support 210 210 to at25 SPI eeprom driver (this is meant for the above ACPI snippet):: 211 211 ··· 362 362 specifies the path to the controller. In order to use these GPIOs in Linux 363 363 we need to translate them to the corresponding Linux GPIO descriptors. 364 364 365 - There is a standard GPIO API for that and is documented in 365 + There is a standard GPIO API for that and it is documented in 366 366 Documentation/admin-guide/gpio/. 367 367 368 368 In the above example we can get the corresponding two GPIO descriptors with ··· 538 538 PCI hierarchy representation 539 539 ============================ 540 540 541 - Sometimes could be useful to enumerate a PCI device, knowing its position on the 542 - PCI bus. 541 + Sometimes it could be useful to enumerate a PCI device, knowing its position on 542 + the PCI bus. 543 543 544 544 For example, some systems use PCI devices soldered directly on the mother board, 545 545 in a fixed position (ethernet, Wi-Fi, serial ports, etc.). In this conditions it ··· 550 550 the chipset root port to the final device, through all the intermediate 551 551 bridges/switches of the board. 552 552 553 - For example, let us assume to have a system with a PCIe serial port, an 553 + For example, let's assume we have a system with a PCIe serial port, an 554 554 Exar XR17V3521, soldered on the main board. This UART chip also includes 555 555 16 GPIOs and we want to add the property ``gpio-line-names`` [1] to these pins. 556 556 In this case, the ``lspci`` output for this component is:: ··· 593 593 594 594 Bus: 0 - Device: 14 - Function: 1 595 595 596 - To find this information is necessary disassemble the BIOS ACPI tables, in 597 - particular the DSDT (see also [2]):: 596 + To find this information, it is necessary to disassemble the BIOS ACPI tables, 597 + in particular the DSDT (see also [2]):: 598 598 599 599 mkdir ~/tables/ 600 600 cd ~/tables/
+11 -14
Documentation/firmware-guide/acpi/osi.rst
··· 41 41 What should an OEM do if they want to support Linux and Windows 42 42 using the same BIOS image? Often they need to do something different 43 43 for Linux to deal with how Linux is different from Windows. 44 - Here the BIOS should ask exactly what it wants to know: 45 44 45 + In this case, the OEM should create custom ASL to be executed by the 46 + Linux kernel and changes to Linux kernel drivers to execute this custom 47 + ASL. The easiest way to accomplish this is to introduce a device specific 48 + method (_DSM) that is called from the Linux kernel. 49 + 50 + In the past the kernel used to support something like: 46 51 _OSI("Linux-OEM-my_interface_name") 47 52 where 'OEM' is needed if this is an OEM-specific hook, 48 53 and 'my_interface_name' describes the hook, which could be a 49 54 quirk, a bug, or a bug-fix. 50 55 51 - In addition, the OEM should send a patch to upstream Linux 52 - via the linux-acpi@vger.kernel.org mailing list. When that patch 53 - is checked into Linux, the OS will answer "YES" when the BIOS 54 - on the OEM's system uses _OSI to ask if the interface is supported 55 - by the OS. Linux distributors can back-port that patch for Linux 56 - pre-installs, and it will be included by all distributions that 57 - re-base to upstream. If the distribution can not update the kernel binary, 58 - they can also add an acpi_osi=Linux-OEM-my_interface_name 59 - cmdline parameter to the boot loader, as needed. 60 - 61 - If the string refers to a feature where the upstream kernel 62 - eventually grows support, a patch should be sent to remove 63 - the string when that support is added to the kernel. 56 + However this was discovered to be abused by other BIOS vendors to change 57 + completely unrelated code on completely unrelated systems. This prompted 58 + an evaluation of all of it's uses. This uncovered that they aren't needed 59 + for any of the original reasons. As such, the kernel will not respond to 60 + any custom Linux-* strings by default. 64 61 65 62 That was easy. Read on, to find out how to do it wrong. 66 63
-3
MAINTAINERS
··· 348 348 R: Len Brown <lenb@kernel.org> 349 349 L: linux-acpi@vger.kernel.org 350 350 S: Supported 351 - W: https://01.org/linux-acpi 352 351 Q: https://patchwork.kernel.org/project/linux-acpi/list/ 353 352 B: https://bugzilla.kernel.org 354 353 T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm ··· 426 427 R: Zhang Rui <rui.zhang@intel.com> 427 428 L: linux-acpi@vger.kernel.org 428 429 S: Supported 429 - W: https://01.org/linux-acpi 430 430 B: https://bugzilla.kernel.org 431 431 F: drivers/acpi/*thermal* 432 432 ··· 10376 10378 M: Sujith Thomas <sujith.thomas@intel.com> 10377 10379 L: linux-pm@vger.kernel.org 10378 10380 S: Supported 10379 - W: https://01.org/linux-acpi 10380 10381 F: drivers/thermal/intel/intel_menlow.c 10381 10382 10382 10383 INTEL P-Unit IPC DRIVER
-1
arch/loongarch/Kconfig
··· 10 10 select ARCH_ENABLE_MEMORY_HOTPLUG 11 11 select ARCH_ENABLE_MEMORY_HOTREMOVE 12 12 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI 13 - select ARCH_HAS_PHYS_TO_DMA 14 13 select ARCH_HAS_PTE_SPECIAL 15 14 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 16 15 select ARCH_INLINE_READ_LOCK if !PREEMPTION
+18 -28
arch/loongarch/kernel/dma.c
··· 2 2 /* 3 3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 4 4 */ 5 - #include <linux/init.h> 5 + #include <linux/acpi.h> 6 6 #include <linux/dma-direct.h> 7 - #include <linux/dma-mapping.h> 8 - #include <linux/dma-map-ops.h> 9 - #include <linux/swiotlb.h> 10 7 11 - #include <asm/bootinfo.h> 12 - #include <asm/dma.h> 13 - #include <asm/loongson.h> 14 - 15 - /* 16 - * We extract 4bit node id (bit 44~47) from Loongson-3's 17 - * 48bit physical address space and embed it into 40bit. 18 - */ 19 - 20 - static int node_id_offset; 21 - 22 - dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 8 + void acpi_arch_dma_setup(struct device *dev) 23 9 { 24 - long nid = (paddr >> 44) & 0xf; 10 + int ret; 11 + u64 mask, end = 0; 12 + const struct bus_dma_region *map = NULL; 25 13 26 - return ((nid << 44) ^ paddr) | (nid << node_id_offset); 27 - } 14 + ret = acpi_dma_get_range(dev, &map); 15 + if (!ret && map) { 16 + const struct bus_dma_region *r = map; 28 17 29 - phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) 30 - { 31 - long nid = (daddr >> node_id_offset) & 0xf; 18 + for (end = 0; r->size; r++) { 19 + if (r->dma_start + r->size - 1 > end) 20 + end = r->dma_start + r->size - 1; 21 + } 32 22 33 - return ((nid << node_id_offset) ^ daddr) | (nid << 44); 34 - } 23 + mask = DMA_BIT_MASK(ilog2(end) + 1); 24 + dev->bus_dma_limit = end; 25 + dev->dma_range_map = map; 26 + dev->coherent_dma_mask = min(dev->coherent_dma_mask, mask); 27 + *dev->dma_mask = min(*dev->dma_mask, mask); 28 + } 35 29 36 - void __init plat_swiotlb_setup(void) 37 - { 38 - swiotlb_init(true, SWIOTLB_VERBOSE); 39 - node_id_offset = ((readl(LS7A_DMA_CFG) & LS7A_DMA_NODE_MASK) >> LS7A_DMA_NODE_SHF) + 36; 40 30 }
+1 -1
arch/loongarch/kernel/setup.c
··· 247 247 sparse_init(); 248 248 memblock_set_bottom_up(true); 249 249 250 - plat_swiotlb_setup(); 250 + swiotlb_init(true, SWIOTLB_VERBOSE); 251 251 252 252 dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); 253 253
-4
drivers/acpi/Kconfig
··· 27 27 Management (APM) specification. If both ACPI and APM support 28 28 are configured, ACPI is used. 29 29 30 - The project home page for the Linux ACPI subsystem is here: 31 - <https://01.org/linux-acpi> 32 - 33 30 Linux support for ACPI is based on Intel Corporation's ACPI 34 31 Component Architecture (ACPI CA). For more information on the 35 32 ACPI CA, see: ··· 344 347 depends on !STANDALONE 345 348 help 346 349 This option supports a custom DSDT by linking it into the kernel. 347 - See Documentation/admin-guide/acpi/dsdt-override.rst 348 350 349 351 Enter the full path name to the file which includes the AmlCode 350 352 or dsdt_aml_code declaration.
-5
drivers/acpi/ac.c
··· 36 36 static int acpi_ac_remove(struct acpi_device *device); 37 37 static void acpi_ac_notify(struct acpi_device *device, u32 event); 38 38 39 - struct acpi_ac_bl { 40 - const char *hid; 41 - int hrv; 42 - }; 43 - 44 39 static const struct acpi_device_id ac_device_ids[] = { 45 40 {"ACPI0003", 0}, 46 41 {"", 0},
+4 -2
drivers/acpi/acpi_amba.c
··· 21 21 22 22 static const struct acpi_device_id amba_id_list[] = { 23 23 {"ARMH0061", 0}, /* PL061 GPIO Device */ 24 + {"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */ 24 25 {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ 25 26 {"ARMHC501", 0}, /* ARM CoreSight ETR */ 26 27 {"ARMHC502", 0}, /* ARM CoreSight STM */ ··· 49 48 static int amba_handler_attach(struct acpi_device *adev, 50 49 const struct acpi_device_id *id) 51 50 { 51 + struct acpi_device *parent = acpi_dev_parent(adev); 52 52 struct amba_device *dev; 53 53 struct resource_entry *rentry; 54 54 struct list_head resource_list; ··· 99 97 * attached to it, that physical device should be the parent of 100 98 * the amba device we are about to create. 101 99 */ 102 - if (adev->parent) 103 - dev->dev.parent = acpi_get_first_physical_node(adev->parent); 100 + if (parent) 101 + dev->dev.parent = acpi_get_first_physical_node(parent); 104 102 105 103 ACPI_COMPANION_SET(&dev->dev, adev); 106 104
+1 -8
drivers/acpi/acpi_apd.c
··· 60 60 } 61 61 62 62 #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE 63 - static int misc_check_res(struct acpi_resource *ares, void *data) 64 - { 65 - struct resource res; 66 - 67 - return !acpi_dev_resource_memory(ares, &res); 68 - } 69 63 70 64 static int fch_misc_setup(struct apd_private_data *pdata) 71 65 { ··· 76 82 return -ENOMEM; 77 83 78 84 INIT_LIST_HEAD(&resource_list); 79 - ret = acpi_dev_get_resources(adev, &resource_list, misc_check_res, 80 - NULL); 85 + ret = acpi_dev_get_memory_resources(adev, &resource_list); 81 86 if (ret < 0) 82 87 return -ENOENT; 83 88
+22
drivers/acpi/acpi_fpdt.c
··· 143 143 144 144 static struct kobject *fpdt_kobj; 145 145 146 + #if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT 147 + #include <linux/processor.h> 148 + static bool fpdt_address_valid(u64 address) 149 + { 150 + /* 151 + * On some systems the table contains invalid addresses 152 + * with unsuppored high address bits set, check for this. 153 + */ 154 + return !(address >> boot_cpu_data.x86_phys_bits); 155 + } 156 + #else 157 + static bool fpdt_address_valid(u64 address) 158 + { 159 + return true; 160 + } 161 + #endif 162 + 146 163 static int fpdt_process_subtable(u64 address, u32 subtable_type) 147 164 { 148 165 struct fpdt_subtable_header *subtable_header; ··· 167 150 char *signature = (subtable_type == SUBTABLE_FBPT ? "FBPT" : "S3PT"); 168 151 u32 length, offset; 169 152 int result; 153 + 154 + if (!fpdt_address_valid(address)) { 155 + pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address); 156 + return -EINVAL; 157 + } 170 158 171 159 subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header)); 172 160 if (!subtable_header)
+29 -40
drivers/acpi/acpi_lpss.c
··· 167 167 168 168 static void byt_pwm_setup(struct lpss_private_data *pdata) 169 169 { 170 - struct acpi_device *adev = pdata->adev; 170 + u64 uid; 171 171 172 172 /* Only call pwm_add_table for the first PWM controller */ 173 - if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1")) 173 + if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1) 174 174 return; 175 175 176 176 pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup)); ··· 180 180 181 181 static void byt_i2c_setup(struct lpss_private_data *pdata) 182 182 { 183 - const char *uid_str = acpi_device_uid(pdata->adev); 184 183 acpi_handle handle = pdata->adev->handle; 185 184 unsigned long long shared_host = 0; 186 185 acpi_status status; 187 - long uid = 0; 186 + u64 uid; 188 187 189 - /* Expected to always be true, but better safe then sorry */ 190 - if (uid_str && !kstrtol(uid_str, 10, &uid) && uid) { 188 + /* Expected to always be successfull, but better safe then sorry */ 189 + if (!acpi_dev_uid_to_integer(pdata->adev, &uid) && uid) { 191 190 /* Detect I2C bus shared with PUNIT and ignore its d3 status */ 192 191 status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host); 193 192 if (ACPI_SUCCESS(status) && shared_host) ··· 210 211 211 212 static void bsw_pwm_setup(struct lpss_private_data *pdata) 212 213 { 213 - struct acpi_device *adev = pdata->adev; 214 + u64 uid; 214 215 215 216 /* Only call pwm_add_table for the first PWM controller */ 216 - if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1")) 217 + if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1) 217 218 return; 218 219 219 220 pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup)); ··· 390 391 }; 391 392 392 393 #ifdef CONFIG_X86_INTEL_LPSS 393 - 394 - static int is_memory(struct acpi_resource *res, void *not_used) 395 - { 396 - struct resource r; 397 - 398 - return !acpi_dev_resource_memory(res, &r); 399 - } 400 394 401 395 /* LPSS main clock device. */ 402 396 static struct platform_device *lpss_clk_dev; ··· 651 659 return -ENOMEM; 652 660 653 661 INIT_LIST_HEAD(&resource_list); 654 - ret = acpi_dev_get_resources(adev, &resource_list, is_memory, NULL); 662 + ret = acpi_dev_get_memory_resources(adev, &resource_list); 655 663 if (ret < 0) 656 664 goto err_out; 657 665 658 - list_for_each_entry(rentry, &resource_list, node) 659 - if (resource_type(rentry->res) == IORESOURCE_MEM) { 660 - if (dev_desc->prv_size_override) 661 - pdata->mmio_size = dev_desc->prv_size_override; 662 - else 663 - pdata->mmio_size = resource_size(rentry->res); 664 - pdata->mmio_base = ioremap(rentry->res->start, 665 - pdata->mmio_size); 666 - break; 667 - } 666 + rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node); 667 + if (rentry) { 668 + if (dev_desc->prv_size_override) 669 + pdata->mmio_size = dev_desc->prv_size_override; 670 + else 671 + pdata->mmio_size = resource_size(rentry->res); 672 + pdata->mmio_base = ioremap(rentry->res->start, pdata->mmio_size); 673 + } 668 674 669 675 acpi_dev_free_resource_list(&resource_list); 670 676 671 677 if (!pdata->mmio_base) { 672 678 /* Avoid acpi_bus_attach() instantiating a pdev for this dev. */ 673 679 adev->pnp.type.platform_id = 0; 674 - /* Skip the device, but continue the namespace scan. */ 675 - ret = 0; 676 - goto err_out; 680 + goto out_free; 677 681 } 678 682 679 683 pdata->adev = adev; ··· 680 692 681 693 if (dev_desc->flags & LPSS_CLK) { 682 694 ret = register_device_clock(adev, pdata); 683 - if (ret) { 684 - /* Skip the device, but continue the namespace scan. */ 685 - ret = 0; 686 - goto err_out; 687 - } 695 + if (ret) 696 + goto out_free; 688 697 } 689 698 690 699 /* ··· 693 708 694 709 adev->driver_data = pdata; 695 710 pdev = acpi_create_platform_device(adev, dev_desc->properties); 696 - if (!IS_ERR_OR_NULL(pdev)) { 697 - acpi_lpss_create_device_links(adev, pdev); 698 - return 1; 711 + if (IS_ERR_OR_NULL(pdev)) { 712 + adev->driver_data = NULL; 713 + ret = PTR_ERR(pdev); 714 + goto err_out; 699 715 } 700 716 701 - ret = PTR_ERR(pdev); 702 - adev->driver_data = NULL; 717 + acpi_lpss_create_device_links(adev, pdev); 718 + return 1; 703 719 704 - err_out: 720 + out_free: 721 + /* Skip the device, but continue the namespace scan */ 722 + ret = 0; 723 + err_out: 705 724 kfree(pdata); 706 725 return ret; 707 726 }
+25 -3
drivers/acpi/acpi_pcc.c
··· 23 23 24 24 #include <acpi/pcc.h> 25 25 26 + /* 27 + * Arbitrary retries in case the remote processor is slow to respond 28 + * to PCC commands 29 + */ 30 + #define PCC_CMD_WAIT_RETRIES_NUM 500 31 + 26 32 struct pcc_data { 27 33 struct pcc_mbox_chan *pcc_chan; 28 34 void __iomem *pcc_comm_addr; ··· 69 63 if (IS_ERR(data->pcc_chan)) { 70 64 pr_err("Failed to find PCC channel for subspace %d\n", 71 65 ctx->subspace_id); 66 + kfree(data); 72 67 return AE_NOT_FOUND; 73 68 } 74 69 ··· 79 72 if (!data->pcc_comm_addr) { 80 73 pr_err("Failed to ioremap PCC comm region mem for %d\n", 81 74 ctx->subspace_id); 75 + pcc_mbox_free_channel(data->pcc_chan); 76 + kfree(data); 82 77 return AE_NO_MEMORY; 83 78 } 84 79 ··· 95 86 { 96 87 int ret; 97 88 struct pcc_data *data = region_context; 89 + u64 usecs_lat; 98 90 99 91 reinit_completion(&data->done); 100 92 ··· 106 96 if (ret < 0) 107 97 return AE_ERROR; 108 98 109 - if (data->pcc_chan->mchan->mbox->txdone_irq) 110 - wait_for_completion(&data->done); 99 + if (data->pcc_chan->mchan->mbox->txdone_irq) { 100 + /* 101 + * pcc_chan->latency is just a Nominal value. In reality the remote 102 + * processor could be much slower to reply. So add an arbitrary 103 + * amount of wait on top of Nominal. 104 + */ 105 + usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency; 106 + ret = wait_for_completion_timeout(&data->done, 107 + usecs_to_jiffies(usecs_lat)); 108 + if (ret == 0) { 109 + pr_err("PCC command executed timeout!\n"); 110 + return AE_TIME; 111 + } 112 + } 111 113 112 - mbox_client_txdone(data->pcc_chan->mchan, ret); 114 + mbox_chan_txdone(data->pcc_chan->mchan, ret); 113 115 114 116 memcpy_fromio(value, data->pcc_comm_addr, data->ctx.length); 115 117
+10 -12
drivers/acpi/acpi_platform.c
··· 20 20 #include "internal.h" 21 21 22 22 static const struct acpi_device_id forbidden_id_list[] = { 23 + {"ACPI0009", 0}, /* IOxAPIC */ 24 + {"ACPI000A", 0}, /* IOAPIC */ 23 25 {"PNP0000", 0}, /* PIC */ 24 26 {"PNP0100", 0}, /* Timer */ 25 27 {"PNP0200", 0}, /* AT DMA Controller */ 26 - {"ACPI0009", 0}, /* IOxAPIC */ 27 - {"ACPI000A", 0}, /* IOAPIC */ 28 28 {"SMB0001", 0}, /* ACPI SMBUS virtual device */ 29 - {"", 0}, 29 + { } 30 30 }; 31 31 32 32 static struct platform_device *acpi_platform_device_find_by_companion(struct acpi_device *adev) ··· 78 78 * If the device has parent we need to take its resources into 79 79 * account as well because this device might consume part of those. 80 80 */ 81 - parent = acpi_get_first_physical_node(adev->parent); 81 + parent = acpi_get_first_physical_node(acpi_dev_parent(adev)); 82 82 if (parent && dev_is_pci(parent)) 83 83 dest->parent = pci_find_resource(to_pci_dev(parent), dest); 84 84 } ··· 97 97 struct platform_device *acpi_create_platform_device(struct acpi_device *adev, 98 98 const struct property_entry *properties) 99 99 { 100 + struct acpi_device *parent = acpi_dev_parent(adev); 100 101 struct platform_device *pdev = NULL; 101 102 struct platform_device_info pdevinfo; 102 103 struct resource_entry *rentry; ··· 114 113 115 114 INIT_LIST_HEAD(&resource_list); 116 115 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); 117 - if (count < 0) { 116 + if (count < 0) 118 117 return NULL; 119 - } else if (count > 0) { 120 - resources = kcalloc(count, sizeof(struct resource), 121 - GFP_KERNEL); 118 + if (count > 0) { 119 + resources = kcalloc(count, sizeof(*resources), GFP_KERNEL); 122 120 if (!resources) { 123 - dev_err(&adev->dev, "No memory for resources\n"); 124 121 acpi_dev_free_resource_list(&resource_list); 125 122 return ERR_PTR(-ENOMEM); 126 123 } ··· 136 137 * attached to it, that physical device should be the parent of the 137 138 * platform device we are about to create. 138 139 */ 139 - pdevinfo.parent = adev->parent ? 140 - acpi_get_first_physical_node(adev->parent) : NULL; 140 + pdevinfo.parent = parent ? acpi_get_first_physical_node(parent) : NULL; 141 141 pdevinfo.name = dev_name(&adev->dev); 142 - pdevinfo.id = -1; 142 + pdevinfo.id = PLATFORM_DEVID_NONE; 143 143 pdevinfo.res = resources; 144 144 pdevinfo.num_res = count; 145 145 pdevinfo.fwnode = acpi_fwnode_handle(adev);
+17 -1
drivers/acpi/acpi_video.c
··· 496 496 DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), 497 497 }, 498 498 }, 499 + { 500 + .callback = video_disable_backlight_sysfs_if, 501 + .ident = "Toshiba Satellite Z830", 502 + .matches = { 503 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 504 + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), 505 + }, 506 + }, 507 + { 508 + .callback = video_disable_backlight_sysfs_if, 509 + .ident = "Toshiba Portege Z830", 510 + .matches = { 511 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 512 + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), 513 + }, 514 + }, 499 515 /* 500 516 * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set 501 517 * but the IDs actually follow the Device ID Scheme. ··· 2046 2030 acpi_status status; 2047 2031 2048 2032 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, 2049 - device->parent->handle, 1, 2033 + acpi_dev_parent(device)->handle, 1, 2050 2034 acpi_video_bus_match, NULL, 2051 2035 device, NULL); 2052 2036 if (status == AE_ALREADY_EXISTS) {
+1 -4
drivers/acpi/apei/apei-base.c
··· 125 125 int apei_exec_write_register_value(struct apei_exec_context *ctx, 126 126 struct acpi_whea_header *entry) 127 127 { 128 - int rc; 129 - 130 128 ctx->value = entry->value; 131 - rc = apei_exec_write_register(ctx, entry); 132 129 133 - return rc; 130 + return apei_exec_write_register(ctx, entry); 134 131 } 135 132 EXPORT_SYMBOL_GPL(apei_exec_write_register_value); 136 133
+3
drivers/acpi/apei/bert.c
··· 90 90 91 91 if (skipped) 92 92 pr_info(HW_ERR "Skipped %d error records\n", skipped); 93 + 94 + if (printed + skipped) 95 + pr_info("Total records found: %d\n", printed + skipped); 93 96 } 94 97 95 98 static int __init setup_bert_disable(char *str)
+1 -5
drivers/acpi/apei/erst.c
··· 1020 1020 1021 1021 static int erst_open_pstore(struct pstore_info *psi) 1022 1022 { 1023 - int rc; 1024 - 1025 1023 if (erst_disable) 1026 1024 return -ENODEV; 1027 1025 1028 - rc = erst_get_record_id_begin(&reader_pos); 1029 - 1030 - return rc; 1026 + return erst_get_record_id_begin(&reader_pos); 1031 1027 } 1032 1028 1033 1029 static int erst_close_pstore(struct pstore_info *psi)
+17 -11
drivers/acpi/arm64/dma.c
··· 4 4 #include <linux/device.h> 5 5 #include <linux/dma-direct.h> 6 6 7 - void acpi_arch_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size) 7 + void acpi_arch_dma_setup(struct device *dev) 8 8 { 9 9 int ret; 10 10 u64 end, mask; 11 - u64 dmaaddr = 0, size = 0, offset = 0; 11 + u64 size = 0; 12 + const struct bus_dma_region *map = NULL; 12 13 13 14 /* 14 15 * If @dev is expected to be DMA-capable then the bus code that created ··· 27 26 else 28 27 size = 1ULL << 32; 29 28 30 - ret = acpi_dma_get_range(dev, &dmaaddr, &offset, &size); 29 + ret = acpi_dma_get_range(dev, &map); 30 + if (!ret && map) { 31 + const struct bus_dma_region *r = map; 32 + 33 + for (end = 0; r->size; r++) { 34 + if (r->dma_start + r->size - 1 > end) 35 + end = r->dma_start + r->size - 1; 36 + } 37 + 38 + size = end + 1; 39 + dev->dma_range_map = map; 40 + } 41 + 31 42 if (ret == -ENODEV) 32 43 ret = iort_dma_get_ranges(dev, &size); 33 44 if (!ret) { ··· 47 34 * Limit coherent and dma mask based on size retrieved from 48 35 * firmware. 49 36 */ 50 - end = dmaaddr + size - 1; 37 + end = size - 1; 51 38 mask = DMA_BIT_MASK(ilog2(end) + 1); 52 39 dev->bus_dma_limit = end; 53 40 dev->coherent_dma_mask = min(dev->coherent_dma_mask, mask); 54 41 *dev->dma_mask = min(*dev->dma_mask, mask); 55 42 } 56 - 57 - *dma_addr = dmaaddr; 58 - *dma_size = size; 59 - 60 - ret = dma_direct_set_offset(dev, dmaaddr + offset, dmaaddr, size); 61 - 62 - dev_dbg(dev, "dma_offset(%#08llx)%s\n", offset, ret ? " failed!" : ""); 63 43 }
+16 -19
drivers/acpi/bus.c
··· 456 456 Notification Handling 457 457 -------------------------------------------------------------------------- */ 458 458 459 - /** 459 + /* 460 460 * acpi_bus_notify 461 461 * --------------- 462 462 * Callback for all 'system-level' device notifications (values 0x00-0x7F). ··· 511 511 break; 512 512 } 513 513 514 - adev = acpi_bus_get_acpi_device(handle); 514 + adev = acpi_get_acpi_dev(handle); 515 515 if (!adev) 516 516 goto err; 517 517 ··· 524 524 } 525 525 526 526 if (!hotplug_event) { 527 - acpi_bus_put_acpi_device(adev); 527 + acpi_put_acpi_dev(adev); 528 528 return; 529 529 } 530 530 531 531 if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type))) 532 532 return; 533 533 534 - acpi_bus_put_acpi_device(adev); 534 + acpi_put_acpi_dev(adev); 535 535 536 536 err: 537 537 acpi_evaluate_ost(handle, type, ost_code, NULL); ··· 802 802 803 803 str = obj->string.pointer; 804 804 chr = strchr(str, ','); 805 - strlcpy(modalias, chr ? chr + 1 : str, len); 805 + strscpy(modalias, chr ? chr + 1 : str, len); 806 806 807 807 return true; 808 808 } ··· 822 822 char *modalias, size_t len) 823 823 { 824 824 if (!acpi_of_modalias(adev, modalias, len)) 825 - strlcpy(modalias, default_id, len); 825 + strscpy(modalias, default_id, len); 826 826 } 827 827 EXPORT_SYMBOL_GPL(acpi_set_modalias); 828 828 ··· 925 925 926 926 const void *acpi_device_get_match_data(const struct device *dev) 927 927 { 928 + const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; 928 929 const struct acpi_device_id *match; 929 930 930 - if (!dev->driver->acpi_match_table) 931 + if (!acpi_ids) 931 932 return acpi_of_device_get_match_data(dev); 932 933 933 - match = acpi_match_device(dev->driver->acpi_match_table, dev); 934 + match = acpi_match_device(acpi_ids, dev); 934 935 if (!match) 935 936 return NULL; 936 937 ··· 949 948 bool acpi_driver_match_device(struct device *dev, 950 949 const struct device_driver *drv) 951 950 { 952 - if (!drv->acpi_match_table) 953 - return acpi_of_match_device(ACPI_COMPANION(dev), 954 - drv->of_match_table, 955 - NULL); 951 + const struct acpi_device_id *acpi_ids = drv->acpi_match_table; 952 + const struct of_device_id *of_ids = drv->of_match_table; 956 953 957 - return __acpi_match_device(acpi_companion_match(dev), 958 - drv->acpi_match_table, drv->of_match_table, 959 - NULL, NULL); 954 + if (!acpi_ids) 955 + return acpi_of_match_device(ACPI_COMPANION(dev), of_ids, NULL); 956 + 957 + return __acpi_match_device(acpi_companion_match(dev), acpi_ids, of_ids, NULL, NULL); 960 958 } 961 959 EXPORT_SYMBOL_GPL(acpi_driver_match_device); 962 960 ··· 973 973 */ 974 974 int acpi_bus_register_driver(struct acpi_driver *driver) 975 975 { 976 - int ret; 977 - 978 976 if (acpi_disabled) 979 977 return -ENODEV; 980 978 driver->drv.name = driver->name; 981 979 driver->drv.bus = &acpi_bus_type; 982 980 driver->drv.owner = driver->owner; 983 981 984 - ret = driver_register(&driver->drv); 985 - return ret; 982 + return driver_register(&driver->drv); 986 983 } 987 984 988 985 EXPORT_SYMBOL(acpi_bus_register_driver);
+45
drivers/acpi/cppc_acpi.c
··· 424 424 struct cpc_desc *cpc_ptr; 425 425 int cpu; 426 426 427 + if (acpi_disabled) 428 + return false; 429 + 427 430 for_each_present_cpu(cpu) { 428 431 cpc_ptr = per_cpu(cpc_desc_ptr, cpu); 429 432 if (!cpc_ptr) ··· 1242 1239 return ret; 1243 1240 } 1244 1241 EXPORT_SYMBOL_GPL(cppc_get_perf_caps); 1242 + 1243 + /** 1244 + * cppc_perf_ctrs_in_pcc - Check if any perf counters are in a PCC region. 1245 + * 1246 + * CPPC has flexibility about how CPU performance counters are accessed. 1247 + * One of the choices is PCC regions, which can have a high access latency. This 1248 + * routine allows callers of cppc_get_perf_ctrs() to know this ahead of time. 1249 + * 1250 + * Return: true if any of the counters are in PCC regions, false otherwise 1251 + */ 1252 + bool cppc_perf_ctrs_in_pcc(void) 1253 + { 1254 + int cpu; 1255 + 1256 + for_each_present_cpu(cpu) { 1257 + struct cpc_register_resource *ref_perf_reg; 1258 + struct cpc_desc *cpc_desc; 1259 + 1260 + cpc_desc = per_cpu(cpc_desc_ptr, cpu); 1261 + 1262 + if (CPC_IN_PCC(&cpc_desc->cpc_regs[DELIVERED_CTR]) || 1263 + CPC_IN_PCC(&cpc_desc->cpc_regs[REFERENCE_CTR]) || 1264 + CPC_IN_PCC(&cpc_desc->cpc_regs[CTR_WRAP_TIME])) 1265 + return true; 1266 + 1267 + 1268 + ref_perf_reg = &cpc_desc->cpc_regs[REFERENCE_PERF]; 1269 + 1270 + /* 1271 + * If reference perf register is not supported then we should 1272 + * use the nominal perf value 1273 + */ 1274 + if (!CPC_SUPPORTED(ref_perf_reg)) 1275 + ref_perf_reg = &cpc_desc->cpc_regs[NOMINAL_PERF]; 1276 + 1277 + if (CPC_IN_PCC(ref_perf_reg)) 1278 + return true; 1279 + } 1280 + 1281 + return false; 1282 + } 1283 + EXPORT_SYMBOL_GPL(cppc_perf_ctrs_in_pcc); 1245 1284 1246 1285 /** 1247 1286 * cppc_get_perf_ctrs - Read a CPU's performance feedback counters.
+22 -16
drivers/acpi/device_pm.c
··· 75 75 int acpi_device_get_power(struct acpi_device *device, int *state) 76 76 { 77 77 int result = ACPI_STATE_UNKNOWN; 78 + struct acpi_device *parent; 78 79 int error; 79 80 80 81 if (!device || !state) 81 82 return -EINVAL; 82 83 84 + parent = acpi_dev_parent(device); 85 + 83 86 if (!device->flags.power_manageable) { 84 87 /* TBD: Non-recursive algorithm for walking up hierarchy. */ 85 - *state = device->parent ? 86 - device->parent->power.state : ACPI_STATE_D0; 88 + *state = parent ? parent->power.state : ACPI_STATE_D0; 87 89 goto out; 88 90 } 89 91 ··· 124 122 * point, the fact that the device is in D0 implies that the parent has 125 123 * to be in D0 too, except if ignore_parent is set. 126 124 */ 127 - if (!device->power.flags.ignore_parent && device->parent 128 - && device->parent->power.state == ACPI_STATE_UNKNOWN 129 - && result == ACPI_STATE_D0) 130 - device->parent->power.state = ACPI_STATE_D0; 125 + if (!device->power.flags.ignore_parent && parent && 126 + parent->power.state == ACPI_STATE_UNKNOWN && 127 + result == ACPI_STATE_D0) 128 + parent->power.state = ACPI_STATE_D0; 131 129 132 130 *state = result; 133 131 ··· 193 191 return -ENODEV; 194 192 } 195 193 196 - if (!device->power.flags.ignore_parent && device->parent && 197 - state < device->parent->power.state) { 198 - acpi_handle_debug(device->handle, 199 - "Cannot transition to %s for parent in %s\n", 200 - acpi_power_state_string(state), 201 - acpi_power_state_string(device->parent->power.state)); 202 - return -ENODEV; 194 + if (!device->power.flags.ignore_parent) { 195 + struct acpi_device *parent; 196 + 197 + parent = acpi_dev_parent(device); 198 + if (parent && state < parent->power.state) { 199 + acpi_handle_debug(device->handle, 200 + "Cannot transition to %s for parent in %s\n", 201 + acpi_power_state_string(state), 202 + acpi_power_state_string(parent->power.state)); 203 + return -ENODEV; 204 + } 203 205 } 204 206 205 207 /* ··· 503 497 504 498 acpi_handle_debug(handle, "Wake notify\n"); 505 499 506 - adev = acpi_bus_get_acpi_device(handle); 500 + adev = acpi_get_acpi_dev(handle); 507 501 if (!adev) 508 502 return; 509 503 ··· 521 515 522 516 mutex_unlock(&acpi_pm_notifier_lock); 523 517 524 - acpi_bus_put_acpi_device(adev); 518 + acpi_put_acpi_dev(adev); 525 519 } 526 520 527 521 /** ··· 1466 1460 * not valid to ask for the ACPI power state of the device in that time frame. 1467 1461 * 1468 1462 * This function is intended to be used in a driver's probe or remove 1469 - * function. See Documentation/firmware-guide/acpi/low-power-probe.rst for 1463 + * function. See Documentation/firmware-guide/acpi/non-d0-probe.rst for 1470 1464 * more information. 1471 1465 */ 1472 1466 bool acpi_dev_state_d0(struct device *dev)
-3
drivers/acpi/dptf/Kconfig
··· 11 11 a coordinated approach for different policies to effect the hardware 12 12 state of a system. 13 13 14 - For more information see: 15 - <https://01.org/intel%C2%AE-dynamic-platform-and-thermal-framework-dptf-chromium-os/overview> 16 - 17 14 if ACPI_DPTF 18 15 19 16 config DPTF_POWER
+1 -5
drivers/acpi/ec.c
··· 917 917 918 918 int ec_write(u8 addr, u8 val) 919 919 { 920 - int err; 921 - 922 920 if (!first_ec) 923 921 return -ENODEV; 924 922 925 - err = acpi_ec_write(first_ec, addr, val); 926 - 927 - return err; 923 + return acpi_ec_write(first_ec, addr, val); 928 924 } 929 925 EXPORT_SYMBOL(ec_write); 930 926
+27 -31
drivers/acpi/fan_core.c
··· 19 19 20 20 #include "fan.h" 21 21 22 - MODULE_AUTHOR("Paul Diefenbaugh"); 23 - MODULE_DESCRIPTION("ACPI Fan Driver"); 24 - MODULE_LICENSE("GPL"); 25 - 26 - static int acpi_fan_probe(struct platform_device *pdev); 27 - static int acpi_fan_remove(struct platform_device *pdev); 28 - 29 22 static const struct acpi_device_id fan_device_ids[] = { 30 23 ACPI_FAN_DEVICE_IDS, 31 24 {"", 0}, 32 25 }; 33 26 MODULE_DEVICE_TABLE(acpi, fan_device_ids); 34 - 35 - #ifdef CONFIG_PM_SLEEP 36 - static int acpi_fan_suspend(struct device *dev); 37 - static int acpi_fan_resume(struct device *dev); 38 - static const struct dev_pm_ops acpi_fan_pm = { 39 - .resume = acpi_fan_resume, 40 - .freeze = acpi_fan_suspend, 41 - .thaw = acpi_fan_resume, 42 - .restore = acpi_fan_resume, 43 - }; 44 - #define FAN_PM_OPS_PTR (&acpi_fan_pm) 45 - #else 46 - #define FAN_PM_OPS_PTR NULL 47 - #endif 48 - 49 - static struct platform_driver acpi_fan_driver = { 50 - .probe = acpi_fan_probe, 51 - .remove = acpi_fan_remove, 52 - .driver = { 53 - .name = "acpi-fan", 54 - .acpi_match_table = fan_device_ids, 55 - .pm = FAN_PM_OPS_PTR, 56 - }, 57 - }; 58 27 59 28 /* thermal cooling device callbacks */ 60 29 static int fan_get_max_state(struct thermal_cooling_device *cdev, unsigned long ··· 428 459 429 460 return result; 430 461 } 462 + 463 + static const struct dev_pm_ops acpi_fan_pm = { 464 + .resume = acpi_fan_resume, 465 + .freeze = acpi_fan_suspend, 466 + .thaw = acpi_fan_resume, 467 + .restore = acpi_fan_resume, 468 + }; 469 + #define FAN_PM_OPS_PTR (&acpi_fan_pm) 470 + 471 + #else 472 + 473 + #define FAN_PM_OPS_PTR NULL 474 + 431 475 #endif 432 476 477 + static struct platform_driver acpi_fan_driver = { 478 + .probe = acpi_fan_probe, 479 + .remove = acpi_fan_remove, 480 + .driver = { 481 + .name = "acpi-fan", 482 + .acpi_match_table = fan_device_ids, 483 + .pm = FAN_PM_OPS_PTR, 484 + }, 485 + }; 486 + 433 487 module_platform_driver(acpi_fan_driver); 488 + 489 + MODULE_AUTHOR("Paul Diefenbaugh"); 490 + MODULE_DESCRIPTION("ACPI Fan Driver"); 491 + MODULE_LICENSE("GPL");
+3 -3
drivers/acpi/internal.h
··· 102 102 struct list_head node; 103 103 }; 104 104 105 - int acpi_device_add(struct acpi_device *device, 106 - void (*release)(struct device *)); 107 105 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, 108 - int type); 106 + int type, void (*release)(struct device *)); 107 + int acpi_tie_acpi_dev(struct acpi_device *adev); 108 + int acpi_device_add(struct acpi_device *device); 109 109 int acpi_device_setup_files(struct acpi_device *dev); 110 110 void acpi_device_remove_files(struct acpi_device *dev); 111 111 void acpi_device_add_finalize(struct acpi_device *device);
+2 -2
drivers/acpi/irq.c
··· 118 118 if (WARN_ON(ACPI_FAILURE(status))) 119 119 return NULL; 120 120 121 - device = acpi_bus_get_acpi_device(handle); 121 + device = acpi_get_acpi_dev(handle); 122 122 if (WARN_ON(!device)) 123 123 return NULL; 124 124 125 125 result = &device->fwnode; 126 - acpi_bus_put_acpi_device(device); 126 + acpi_put_acpi_dev(device); 127 127 return result; 128 128 } 129 129
+12 -13
drivers/acpi/numa/hmat.c
··· 9 9 */ 10 10 11 11 #define pr_fmt(fmt) "acpi/hmat: " fmt 12 - #define dev_fmt(fmt) "acpi/hmat: " fmt 13 12 14 13 #include <linux/acpi.h> 15 14 #include <linux/bitops.h> ··· 301 302 u8 type, mem_hier; 302 303 303 304 if (hmat_loc->header.length < sizeof(*hmat_loc)) { 304 - pr_notice("HMAT: Unexpected locality header length: %u\n", 305 + pr_notice("Unexpected locality header length: %u\n", 305 306 hmat_loc->header.length); 306 307 return -EINVAL; 307 308 } ··· 313 314 total_size = sizeof(*hmat_loc) + sizeof(*entries) * ipds * tpds + 314 315 sizeof(*inits) * ipds + sizeof(*targs) * tpds; 315 316 if (hmat_loc->header.length < total_size) { 316 - pr_notice("HMAT: Unexpected locality header length:%u, minimum required:%u\n", 317 + pr_notice("Unexpected locality header length:%u, minimum required:%u\n", 317 318 hmat_loc->header.length, total_size); 318 319 return -EINVAL; 319 320 } 320 321 321 - pr_info("HMAT: Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n", 322 + pr_info("Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n", 322 323 hmat_loc->flags, hmat_data_type(type), ipds, tpds, 323 324 hmat_loc->entry_base_unit); 324 325 ··· 362 363 u32 attrs; 363 364 364 365 if (cache->header.length < sizeof(*cache)) { 365 - pr_notice("HMAT: Unexpected cache header length: %u\n", 366 + pr_notice("Unexpected cache header length: %u\n", 366 367 cache->header.length); 367 368 return -EINVAL; 368 369 } 369 370 370 371 attrs = cache->cache_attributes; 371 - pr_info("HMAT: Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n", 372 + pr_info("Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n", 372 373 cache->memory_PD, cache->cache_size, attrs, 373 374 cache->number_of_SMBIOShandles); 374 375 ··· 423 424 struct memory_target *target = NULL; 424 425 425 426 if (p->header.length != sizeof(*p)) { 426 - pr_notice("HMAT: Unexpected address range header length: %u\n", 427 + pr_notice("Unexpected address range header length: %u\n", 427 428 p->header.length); 428 429 return -EINVAL; 429 430 } 430 431 431 432 if (hmat_revision == 1) 432 - pr_info("HMAT: Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n", 433 + pr_info("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n", 433 434 p->reserved3, p->reserved4, p->flags, p->processor_PD, 434 435 p->memory_PD); 435 436 else 436 - pr_info("HMAT: Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n", 437 + pr_info("Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n", 437 438 p->flags, p->processor_PD, p->memory_PD); 438 439 439 440 if ((hmat_revision == 1 && p->flags & ACPI_HMAT_MEMORY_PD_VALID) || 440 441 hmat_revision > 1) { 441 442 target = find_mem_target(p->memory_PD); 442 443 if (!target) { 443 - pr_debug("HMAT: Memory Domain missing from SRAT\n"); 444 + pr_debug("Memory Domain missing from SRAT\n"); 444 445 return -EINVAL; 445 446 } 446 447 } ··· 448 449 int p_node = pxm_to_node(p->processor_PD); 449 450 450 451 if (p_node == NUMA_NO_NODE) { 451 - pr_debug("HMAT: Invalid Processor Domain\n"); 452 + pr_debug("Invalid Processor Domain\n"); 452 453 return -EINVAL; 453 454 } 454 455 target->processor_pxm = p->processor_PD; ··· 839 840 case 2: 840 841 break; 841 842 default: 842 - pr_notice("Ignoring HMAT: Unknown revision:%d\n", hmat_revision); 843 + pr_notice("Ignoring: Unknown revision:%d\n", hmat_revision); 843 844 goto out_put; 844 845 } 845 846 ··· 847 848 if (acpi_table_parse_entries(ACPI_SIG_HMAT, 848 849 sizeof(struct acpi_table_hmat), i, 849 850 hmat_parse_subtable, 0) < 0) { 850 - pr_notice("Ignoring HMAT: Invalid table"); 851 + pr_notice("Ignoring: Invalid table"); 851 852 goto out_put; 852 853 } 853 854 }
-24
drivers/acpi/osi.c
··· 44 44 {"Processor Device", true}, 45 45 {"3.0 _SCP Extensions", true}, 46 46 {"Processor Aggregator Device", true}, 47 - /* 48 - * Linux-Dell-Video is used by BIOS to disable RTD3 for NVidia graphics 49 - * cards as RTD3 is not supported by drivers now. Systems with NVidia 50 - * cards will hang without RTD3 disabled. 51 - * 52 - * Once NVidia drivers officially support RTD3, this _OSI strings can 53 - * be removed if both new and old graphics cards are supported. 54 - */ 55 - {"Linux-Dell-Video", true}, 56 - /* 57 - * Linux-Lenovo-NV-HDMI-Audio is used by BIOS to power on NVidia's HDMI 58 - * audio device which is turned off for power-saving in Windows OS. 59 - * This power management feature observed on some Lenovo Thinkpad 60 - * systems which will not be able to output audio via HDMI without 61 - * a BIOS workaround. 62 - */ 63 - {"Linux-Lenovo-NV-HDMI-Audio", true}, 64 - /* 65 - * Linux-HPI-Hybrid-Graphics is used by BIOS to enable dGPU to 66 - * output video directly to external monitors on HP Inc. mobile 67 - * workstations as Nvidia and AMD VGA drivers provide limited 68 - * hybrid graphics supports. 69 - */ 70 - {"Linux-HPI-Hybrid-Graphics", true}, 71 47 }; 72 48 73 49 static u32 acpi_osi_handler(acpi_string interface, u32 supported)
+12 -63
drivers/acpi/pci_root.c
··· 312 312 */ 313 313 struct pci_dev *acpi_get_pci_dev(acpi_handle handle) 314 314 { 315 - int dev, fn; 316 - unsigned long long adr; 317 - acpi_status status; 318 - acpi_handle phandle; 319 - struct pci_bus *pbus; 320 - struct pci_dev *pdev = NULL; 321 - struct acpi_handle_node *node, *tmp; 322 - struct acpi_pci_root *root; 323 - LIST_HEAD(device_list); 315 + struct acpi_device *adev = acpi_fetch_acpi_dev(handle); 316 + struct acpi_device_physical_node *pn; 317 + struct pci_dev *pci_dev = NULL; 324 318 325 - /* 326 - * Walk up the ACPI CA namespace until we reach a PCI root bridge. 327 - */ 328 - phandle = handle; 329 - while (!acpi_is_root_bridge(phandle)) { 330 - node = kzalloc(sizeof(struct acpi_handle_node), GFP_KERNEL); 331 - if (!node) 332 - goto out; 319 + if (!adev) 320 + return NULL; 333 321 334 - INIT_LIST_HEAD(&node->node); 335 - node->handle = phandle; 336 - list_add(&node->node, &device_list); 322 + mutex_lock(&adev->physical_node_lock); 337 323 338 - status = acpi_get_parent(phandle, &phandle); 339 - if (ACPI_FAILURE(status)) 340 - goto out; 341 - } 342 - 343 - root = acpi_pci_find_root(phandle); 344 - if (!root) 345 - goto out; 346 - 347 - pbus = root->bus; 348 - 349 - /* 350 - * Now, walk back down the PCI device tree until we return to our 351 - * original handle. Assumes that everything between the PCI root 352 - * bridge and the device we're looking for must be a P2P bridge. 353 - */ 354 - list_for_each_entry(node, &device_list, node) { 355 - acpi_handle hnd = node->handle; 356 - status = acpi_evaluate_integer(hnd, "_ADR", NULL, &adr); 357 - if (ACPI_FAILURE(status)) 358 - goto out; 359 - dev = (adr >> 16) & 0xffff; 360 - fn = adr & 0xffff; 361 - 362 - pdev = pci_get_slot(pbus, PCI_DEVFN(dev, fn)); 363 - if (!pdev || hnd == handle) 364 - break; 365 - 366 - pbus = pdev->subordinate; 367 - pci_dev_put(pdev); 368 - 369 - /* 370 - * This function may be called for a non-PCI device that has a 371 - * PCI parent (eg. a disk under a PCI SATA controller). In that 372 - * case pdev->subordinate will be NULL for the parent. 373 - */ 374 - if (!pbus) { 375 - dev_dbg(&pdev->dev, "Not a PCI-to-PCI bridge\n"); 376 - pdev = NULL; 324 + list_for_each_entry(pn, &adev->physical_node_list, node) { 325 + if (dev_is_pci(pn->dev)) { 326 + pci_dev = to_pci_dev(pn->dev); 377 327 break; 378 328 } 379 329 } 380 - out: 381 - list_for_each_entry_safe(node, tmp, &device_list, node) 382 - kfree(node); 383 330 384 - return pdev; 331 + mutex_unlock(&adev->physical_node_lock); 332 + 333 + return pci_dev; 385 334 } 386 335 EXPORT_SYMBOL_GPL(acpi_get_pci_dev); 387 336
+8 -3
drivers/acpi/power.c
··· 944 944 return NULL; 945 945 946 946 device = &resource->device; 947 - acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER); 947 + acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER, 948 + acpi_release_power_resource); 948 949 mutex_init(&resource->resource_lock); 949 950 INIT_LIST_HEAD(&resource->list_node); 950 951 INIT_LIST_HEAD(&resource->dependents); 951 952 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 952 953 strcpy(acpi_device_class(device), ACPI_POWER_CLASS); 953 954 device->power.state = ACPI_STATE_UNKNOWN; 955 + device->flags.match_driver = true; 954 956 955 957 /* Evaluate the object to get the system level and resource order. */ 956 958 status = acpi_evaluate_object(handle, NULL, NULL, &buffer); ··· 969 967 970 968 pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device)); 971 969 972 - device->flags.match_driver = true; 973 - result = acpi_device_add(device, acpi_release_power_resource); 970 + result = acpi_tie_acpi_dev(device); 971 + if (result) 972 + goto err; 973 + 974 + result = acpi_device_add(device); 974 975 if (result) 975 976 goto err; 976 977
+4 -4
drivers/acpi/processor_idle.c
··· 804 804 805 805 state = &drv->states[count]; 806 806 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); 807 - strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 807 + strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 808 808 state->exit_latency = cx->latency; 809 809 state->target_residency = cx->latency * latency_factor; 810 810 state->enter = acpi_idle_enter; ··· 973 973 974 974 obj = pkg_elem + 9; 975 975 if (obj->type == ACPI_TYPE_STRING) 976 - strlcpy(lpi_state->desc, obj->string.pointer, 976 + strscpy(lpi_state->desc, obj->string.pointer, 977 977 ACPI_CX_DESC_LEN); 978 978 979 979 lpi_state->index = state_idx; ··· 1039 1039 result->arch_flags = parent->arch_flags; 1040 1040 result->index = parent->index; 1041 1041 1042 - strlcpy(result->desc, local->desc, ACPI_CX_DESC_LEN); 1042 + strscpy(result->desc, local->desc, ACPI_CX_DESC_LEN); 1043 1043 strlcat(result->desc, "+", ACPI_CX_DESC_LEN); 1044 1044 strlcat(result->desc, parent->desc, ACPI_CX_DESC_LEN); 1045 1045 return true; ··· 1213 1213 1214 1214 state = &drv->states[i]; 1215 1215 snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i); 1216 - strlcpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); 1216 + strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); 1217 1217 state->exit_latency = lpi->wake_latency; 1218 1218 state->target_residency = lpi->min_residency; 1219 1219 if (lpi->arch_flags)
+8 -5
drivers/acpi/property.c
··· 304 304 ret = acpi_dev_get_property(adev, "compatible", 305 305 ACPI_TYPE_STRING, &of_compatible); 306 306 if (ret) { 307 - if (adev->parent 308 - && adev->parent->flags.of_compatible_ok) 307 + struct acpi_device *parent; 308 + 309 + parent = acpi_dev_parent(adev); 310 + if (parent && parent->flags.of_compatible_ok) 309 311 goto out; 310 312 311 313 return; ··· 1269 1267 return to_acpi_data_node(fwnode)->parent; 1270 1268 } 1271 1269 if (is_acpi_device_node(fwnode)) { 1272 - struct device *dev = to_acpi_device_node(fwnode)->dev.parent; 1270 + struct acpi_device *parent; 1273 1271 1274 - if (dev) 1275 - return acpi_fwnode_handle(to_acpi_device(dev)); 1272 + parent = acpi_dev_parent(to_acpi_device_node(fwnode)); 1273 + if (parent) 1274 + return acpi_fwnode_handle(parent); 1276 1275 } 1277 1276 1278 1277 return NULL;
+46
drivers/acpi/resource.c
··· 399 399 { } 400 400 }; 401 401 402 + static const struct dmi_system_id asus_laptop[] = { 403 + { 404 + .ident = "Asus Vivobook K3402ZA", 405 + .matches = { 406 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 407 + DMI_MATCH(DMI_BOARD_NAME, "K3402ZA"), 408 + }, 409 + }, 410 + { 411 + .ident = "Asus Vivobook K3502ZA", 412 + .matches = { 413 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 414 + DMI_MATCH(DMI_BOARD_NAME, "K3502ZA"), 415 + }, 416 + }, 417 + { 418 + .ident = "Asus Vivobook S5402ZA", 419 + .matches = { 420 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 421 + DMI_MATCH(DMI_BOARD_NAME, "S5402ZA"), 422 + }, 423 + }, 424 + { } 425 + }; 426 + 402 427 struct irq_override_cmp { 403 428 const struct dmi_system_id *system; 404 429 unsigned char irq; ··· 434 409 435 410 static const struct irq_override_cmp skip_override_table[] = { 436 411 { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 }, 412 + { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 }, 437 413 }; 438 414 439 415 static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity, ··· 716 690 717 691 memset(&win, 0, sizeof(win)); 718 692 693 + if (acpi_dev_filter_resource_type(ares, IORESOURCE_MEM)) 694 + return 1; 695 + 719 696 return !(acpi_dev_resource_memory(ares, res) 720 697 || acpi_dev_resource_address_space(ares, &win) 721 698 || acpi_dev_resource_ext_address_space(ares, &win)); ··· 746 717 METHOD_NAME__DMA); 747 718 } 748 719 EXPORT_SYMBOL_GPL(acpi_dev_get_dma_resources); 720 + 721 + /** 722 + * acpi_dev_get_memory_resources - Get current memory resources of a device. 723 + * @adev: ACPI device node to get the resources for. 724 + * @list: Head of the resultant list of resources (must be empty). 725 + * 726 + * This is a helper function that locates all memory type resources of @adev 727 + * with acpi_dev_get_resources(). 728 + * 729 + * The number of resources in the output list is returned on success, an error 730 + * code reflecting the error condition is returned otherwise. 731 + */ 732 + int acpi_dev_get_memory_resources(struct acpi_device *adev, struct list_head *list) 733 + { 734 + return acpi_dev_get_resources(adev, list, is_memory, NULL); 735 + } 736 + EXPORT_SYMBOL_GPL(acpi_dev_get_memory_resources); 749 737 750 738 /** 751 739 * acpi_dev_filter_resource_type - Filter ACPI resource according to resource
+1 -1
drivers/acpi/sbs.c
··· 632 632 633 633 mutex_init(&sbs->lock); 634 634 635 - sbs->hc = acpi_driver_data(device->parent); 635 + sbs->hc = acpi_driver_data(acpi_dev_parent(device)); 636 636 sbs->device = device; 637 637 strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); 638 638 strcpy(acpi_device_class(device), ACPI_SBS_CLASS);
+1 -1
drivers/acpi/sbshc.c
··· 266 266 mutex_init(&hc->lock); 267 267 init_waitqueue_head(&hc->wait); 268 268 269 - hc->ec = acpi_driver_data(device->parent); 269 + hc->ec = acpi_driver_data(acpi_dev_parent(device)); 270 270 hc->offset = (val >> 8) & 0xff; 271 271 hc->query_bit = val & 0xff; 272 272 device->driver_data = hc;
+101 -88
drivers/acpi/scan.c
··· 20 20 #include <linux/platform_data/x86/apple.h> 21 21 #include <linux/pgtable.h> 22 22 #include <linux/crc32.h> 23 + #include <linux/dma-direct.h> 23 24 24 25 #include "internal.h" 25 26 ··· 29 28 #define ACPI_BUS_CLASS "system_bus" 30 29 #define ACPI_BUS_HID "LNXSYBUS" 31 30 #define ACPI_BUS_DEVICE_NAME "System Bus" 32 - 33 - #define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent) 34 31 35 32 #define INVALID_ACPI_HANDLE ((acpi_handle)empty_zero_page) 36 33 ··· 428 429 acpi_evaluate_ost(adev->handle, src, ost_code, NULL); 429 430 430 431 out: 431 - acpi_bus_put_acpi_device(adev); 432 + acpi_put_acpi_dev(adev); 432 433 mutex_unlock(&acpi_scan_lock); 433 434 unlock_device_hotplug(); 434 435 } ··· 598 599 acpi_dev_get(dev); 599 600 } 600 601 601 - struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle) 602 + /** 603 + * acpi_get_acpi_dev - Retrieve ACPI device object and reference count it. 604 + * @handle: ACPI handle associated with the requested ACPI device object. 605 + * 606 + * Return a pointer to the ACPI device object associated with @handle and bump 607 + * up that object's reference counter (under the ACPI Namespace lock), if 608 + * present, or return NULL otherwise. 609 + * 610 + * The ACPI device object reference acquired by this function needs to be 611 + * dropped via acpi_dev_put(). 612 + */ 613 + struct acpi_device *acpi_get_acpi_dev(acpi_handle handle) 602 614 { 603 615 return handle_to_device(handle, get_acpi_device); 604 616 } 605 - EXPORT_SYMBOL_GPL(acpi_bus_get_acpi_device); 617 + EXPORT_SYMBOL_GPL(acpi_get_acpi_dev); 606 618 607 619 static struct acpi_device_bus_id *acpi_device_bus_id_match(const char *dev_id) 608 620 { ··· 642 632 return 0; 643 633 } 644 634 645 - static int acpi_tie_acpi_dev(struct acpi_device *adev) 635 + int acpi_tie_acpi_dev(struct acpi_device *adev) 646 636 { 647 637 acpi_handle handle = adev->handle; 648 638 acpi_status status; ··· 672 662 ACPI_FREE(pld); 673 663 } 674 664 675 - static int __acpi_device_add(struct acpi_device *device, 676 - void (*release)(struct device *)) 665 + int acpi_device_add(struct acpi_device *device) 677 666 { 678 667 struct acpi_device_bus_id *acpi_device_bus_id; 679 668 int result; ··· 728 719 729 720 mutex_unlock(&acpi_device_lock); 730 721 731 - if (device->parent) 732 - device->dev.parent = &device->parent->dev; 733 - 734 - device->dev.bus = &acpi_bus_type; 735 - device->dev.release = release; 736 722 result = device_add(&device->dev); 737 723 if (result) { 738 724 dev_err(&device->dev, "Error registering device\n"); ··· 752 748 acpi_detach_data(device->handle, acpi_scan_drop_device); 753 749 754 750 return result; 755 - } 756 - 757 - int acpi_device_add(struct acpi_device *adev, void (*release)(struct device *)) 758 - { 759 - int ret; 760 - 761 - ret = acpi_tie_acpi_dev(adev); 762 - if (ret) 763 - return ret; 764 - 765 - return __acpi_device_add(adev, release); 766 751 } 767 752 768 753 /* -------------------------------------------------------------------------- ··· 798 805 NULL 799 806 }; 800 807 801 - static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) 808 + static struct acpi_device *acpi_find_parent_acpi_dev(acpi_handle handle) 802 809 { 803 - struct acpi_device *device; 804 - acpi_status status; 810 + struct acpi_device *adev; 805 811 806 812 /* 807 813 * Fixed hardware devices do not appear in the namespace and do not ··· 811 819 return acpi_root; 812 820 813 821 do { 814 - status = acpi_get_parent(handle, &handle); 815 - if (ACPI_FAILURE(status)) 816 - return status == AE_NULL_ENTRY ? NULL : acpi_root; 822 + acpi_status status; 817 823 818 - device = acpi_fetch_acpi_dev(handle); 819 - } while (!device); 820 - return device; 824 + status = acpi_get_parent(handle, &handle); 825 + if (ACPI_FAILURE(status)) { 826 + if (status != AE_NULL_ENTRY) 827 + return acpi_root; 828 + 829 + return NULL; 830 + } 831 + adev = acpi_fetch_acpi_dev(handle); 832 + } while (!adev); 833 + return adev; 821 834 } 822 835 823 836 acpi_status ··· 1109 1112 * The device's Bus ID is simply the object name. 1110 1113 * TBD: Shouldn't this value be unique (within the ACPI namespace)? 1111 1114 */ 1112 - if (ACPI_IS_ROOT_DEVICE(device)) { 1115 + if (!acpi_dev_parent(device)) { 1113 1116 strcpy(device->pnp.bus_id, "ACPI"); 1114 1117 return; 1115 1118 } ··· 1464 1467 * acpi_dma_get_range() - Get device DMA parameters. 1465 1468 * 1466 1469 * @dev: device to configure 1467 - * @dma_addr: pointer device DMA address result 1468 - * @offset: pointer to the DMA offset result 1469 - * @size: pointer to DMA range size result 1470 + * @map: pointer to DMA ranges result 1470 1471 * 1471 - * Evaluate DMA regions and return respectively DMA region start, offset 1472 - * and size in dma_addr, offset and size on parsing success; it does not 1473 - * update the passed in values on failure. 1472 + * Evaluate DMA regions and return pointer to DMA regions on 1473 + * parsing success; it does not update the passed in values on failure. 1474 1474 * 1475 1475 * Return 0 on success, < 0 on failure. 1476 1476 */ 1477 - int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset, 1478 - u64 *size) 1477 + int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map) 1479 1478 { 1480 1479 struct acpi_device *adev; 1481 1480 LIST_HEAD(list); 1482 1481 struct resource_entry *rentry; 1483 1482 int ret; 1484 1483 struct device *dma_dev = dev; 1485 - u64 len, dma_start = U64_MAX, dma_end = 0, dma_offset = 0; 1484 + struct bus_dma_region *r; 1486 1485 1487 1486 /* 1488 1487 * Walk the device tree chasing an ACPI companion with a _DMA ··· 1503 1510 1504 1511 ret = acpi_dev_get_dma_resources(adev, &list); 1505 1512 if (ret > 0) { 1506 - list_for_each_entry(rentry, &list, node) { 1507 - if (dma_offset && rentry->offset != dma_offset) { 1508 - ret = -EINVAL; 1509 - dev_warn(dma_dev, "Can't handle multiple windows with different offsets\n"); 1510 - goto out; 1511 - } 1512 - dma_offset = rentry->offset; 1513 - 1514 - /* Take lower and upper limits */ 1515 - if (rentry->res->start < dma_start) 1516 - dma_start = rentry->res->start; 1517 - if (rentry->res->end > dma_end) 1518 - dma_end = rentry->res->end; 1519 - } 1520 - 1521 - if (dma_start >= dma_end) { 1522 - ret = -EINVAL; 1523 - dev_dbg(dma_dev, "Invalid DMA regions configuration\n"); 1513 + r = kcalloc(ret + 1, sizeof(*r), GFP_KERNEL); 1514 + if (!r) { 1515 + ret = -ENOMEM; 1524 1516 goto out; 1525 1517 } 1526 1518 1527 - *dma_addr = dma_start - dma_offset; 1528 - len = dma_end - dma_start; 1529 - *size = max(len, len + 1); 1530 - *offset = dma_offset; 1519 + list_for_each_entry(rentry, &list, node) { 1520 + if (rentry->res->start >= rentry->res->end) { 1521 + kfree(r); 1522 + ret = -EINVAL; 1523 + dev_dbg(dma_dev, "Invalid DMA regions configuration\n"); 1524 + goto out; 1525 + } 1526 + 1527 + r->cpu_start = rentry->res->start; 1528 + r->dma_start = rentry->res->start - rentry->offset; 1529 + r->size = resource_size(rentry->res); 1530 + r->offset = rentry->offset; 1531 + r++; 1532 + } 1533 + 1534 + *map = r; 1531 1535 } 1532 1536 out: 1533 1537 acpi_dev_free_resource_list(&list); ··· 1614 1624 const u32 *input_id) 1615 1625 { 1616 1626 const struct iommu_ops *iommu; 1617 - u64 dma_addr = 0, size = 0; 1618 1627 1619 1628 if (attr == DEV_DMA_NOT_SUPPORTED) { 1620 1629 set_dma_ops(dev, &dma_dummy_ops); 1621 1630 return 0; 1622 1631 } 1623 1632 1624 - acpi_arch_dma_setup(dev, &dma_addr, &size); 1633 + acpi_arch_dma_setup(dev); 1625 1634 1626 1635 iommu = acpi_iommu_configure_id(dev, input_id); 1627 1636 if (PTR_ERR(iommu) == -EPROBE_DEFER) 1628 1637 return -EPROBE_DEFER; 1629 1638 1630 - arch_setup_dma_ops(dev, dma_addr, size, 1639 + arch_setup_dma_ops(dev, 0, U64_MAX, 1631 1640 iommu, attr == DEV_DMA_COHERENT); 1632 1641 1633 1642 return 0; ··· 1637 1648 { 1638 1649 unsigned long long cca = 0; 1639 1650 acpi_status status; 1640 - struct acpi_device *parent = adev->parent; 1651 + struct acpi_device *parent = acpi_dev_parent(adev); 1641 1652 1642 1653 if (parent && parent->flags.cca_seen) { 1643 1654 /* ··· 1681 1692 1682 1693 static bool acpi_is_indirect_io_slave(struct acpi_device *device) 1683 1694 { 1684 - struct acpi_device *parent = device->parent; 1695 + struct acpi_device *parent = acpi_dev_parent(device); 1685 1696 static const struct acpi_device_id indirect_io_hosts[] = { 1686 1697 {"HISI0191", 0}, 1687 1698 {} ··· 1751 1762 } 1752 1763 1753 1764 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, 1754 - int type) 1765 + int type, void (*release)(struct device *)) 1755 1766 { 1767 + struct acpi_device *parent = acpi_find_parent_acpi_dev(handle); 1768 + 1756 1769 INIT_LIST_HEAD(&device->pnp.ids); 1757 1770 device->device_type = type; 1758 1771 device->handle = handle; 1759 - device->parent = acpi_bus_get_parent(handle); 1772 + device->dev.parent = parent ? &parent->dev : NULL; 1773 + device->dev.release = release; 1774 + device->dev.bus = &acpi_bus_type; 1760 1775 fwnode_init(&device->fwnode, &acpi_device_fwnode_ops); 1761 1776 acpi_set_device_status(device, ACPI_STA_DEFAULT); 1762 1777 acpi_device_get_busid(device); ··· 1814 1821 if (!device) 1815 1822 return -ENOMEM; 1816 1823 1817 - acpi_init_device_object(device, handle, type); 1824 + acpi_init_device_object(device, handle, type, acpi_device_release); 1818 1825 /* 1819 1826 * Getting the status is delayed till here so that we can call 1820 1827 * acpi_bus_get_status() and use its quirk handling. Note that ··· 1844 1851 mutex_unlock(&acpi_dep_list_lock); 1845 1852 1846 1853 if (!result) 1847 - result = __acpi_device_add(device, acpi_device_release); 1854 + result = acpi_device_add(device); 1848 1855 1849 1856 if (result) { 1850 1857 acpi_device_release(&device->dev); ··· 1855 1862 acpi_device_add_finalize(device); 1856 1863 1857 1864 acpi_handle_debug(handle, "Added as %s, parent %s\n", 1858 - dev_name(&device->dev), device->parent ? 1859 - dev_name(&device->parent->dev) : "(null)"); 1865 + dev_name(&device->dev), device->dev.parent ? 1866 + dev_name(device->dev.parent) : "(null)"); 1860 1867 1861 1868 *child = device; 1862 1869 return 0; ··· 2228 2235 return 0; 2229 2236 } 2230 2237 2231 - static int acpi_dev_get_first_consumer_dev_cb(struct acpi_dep_data *dep, void *data) 2238 + static int acpi_dev_get_next_consumer_dev_cb(struct acpi_dep_data *dep, void *data) 2232 2239 { 2233 - struct acpi_device *adev; 2240 + struct acpi_device **adev_p = data; 2241 + struct acpi_device *adev = *adev_p; 2234 2242 2235 - adev = acpi_bus_get_acpi_device(dep->consumer); 2243 + /* 2244 + * If we're passed a 'previous' consumer device then we need to skip 2245 + * any consumers until we meet the previous one, and then NULL @data 2246 + * so the next one can be returned. 2247 + */ 2248 + if (adev) { 2249 + if (dep->consumer == adev->handle) 2250 + *adev_p = NULL; 2251 + 2252 + return 0; 2253 + } 2254 + 2255 + adev = acpi_get_acpi_dev(dep->consumer); 2236 2256 if (adev) { 2237 2257 *(struct acpi_device **)data = adev; 2238 2258 return 1; ··· 2298 2292 2299 2293 static int acpi_scan_clear_dep(struct acpi_dep_data *dep, void *data) 2300 2294 { 2301 - struct acpi_device *adev = acpi_bus_get_acpi_device(dep->consumer); 2295 + struct acpi_device *adev = acpi_get_acpi_dev(dep->consumer); 2302 2296 2303 2297 if (adev) { 2304 2298 adev->dep_unmet--; ··· 2374 2368 EXPORT_SYMBOL_GPL(acpi_dev_ready_for_enumeration); 2375 2369 2376 2370 /** 2377 - * acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier 2371 + * acpi_dev_get_next_consumer_dev - Return the next adev dependent on @supplier 2378 2372 * @supplier: Pointer to the dependee device 2373 + * @start: Pointer to the current dependent device 2379 2374 * 2380 - * Returns the first &struct acpi_device which declares itself dependent on 2375 + * Returns the next &struct acpi_device which declares itself dependent on 2381 2376 * @supplier via the _DEP buffer, parsed from the acpi_dep_list. 2382 2377 * 2383 - * The caller is responsible for putting the reference to adev when it is no 2384 - * longer needed. 2378 + * If the returned adev is not passed as @start to this function, the caller is 2379 + * responsible for putting the reference to adev when it is no longer needed. 2385 2380 */ 2386 - struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier) 2381 + struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier, 2382 + struct acpi_device *start) 2387 2383 { 2388 - struct acpi_device *adev = NULL; 2384 + struct acpi_device *adev = start; 2389 2385 2390 2386 acpi_walk_dep_device_list(supplier->handle, 2391 - acpi_dev_get_first_consumer_dev_cb, &adev); 2387 + acpi_dev_get_next_consumer_dev_cb, &adev); 2388 + 2389 + acpi_dev_put(start); 2390 + 2391 + if (adev == start) 2392 + return NULL; 2392 2393 2393 2394 return adev; 2394 2395 } 2395 - EXPORT_SYMBOL_GPL(acpi_dev_get_first_consumer_dev); 2396 + EXPORT_SYMBOL_GPL(acpi_dev_get_next_consumer_dev); 2396 2397 2397 2398 /** 2398 2399 * acpi_bus_scan - Add ACPI device node objects in a given namespace scope.
+27 -3
drivers/acpi/utils.c
··· 794 794 EXPORT_SYMBOL(acpi_dev_hid_uid_match); 795 795 796 796 /** 797 + * acpi_dev_uid_to_integer - treat ACPI device _UID as integer 798 + * @adev: ACPI device to get _UID from 799 + * @integer: output buffer for integer 800 + * 801 + * Considers _UID as integer and converts it to @integer. 802 + * 803 + * Returns 0 on success, or negative error code otherwise. 804 + */ 805 + int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer) 806 + { 807 + const char *uid; 808 + 809 + if (!adev) 810 + return -ENODEV; 811 + 812 + uid = acpi_device_uid(adev); 813 + if (!uid) 814 + return -ENODATA; 815 + 816 + return kstrtou64(uid, 0, integer); 817 + } 818 + EXPORT_SYMBOL(acpi_dev_uid_to_integer); 819 + 820 + /** 797 821 * acpi_dev_found - Detect presence of a given ACPI device in the namespace. 798 822 * @hid: Hardware ID of the device. 799 823 * ··· 902 878 struct acpi_dev_match_info match = {}; 903 879 struct device *dev; 904 880 905 - strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); 881 + strscpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); 906 882 match.uid = uid; 907 883 match.hrv = hrv; 908 884 ··· 935 911 struct acpi_dev_match_info match = {}; 936 912 struct device *dev; 937 913 938 - strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); 914 + strscpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); 939 915 match.uid = uid; 940 916 match.hrv = hrv; 941 917 ··· 985 961 986 962 static int __init acpi_backlight(char *str) 987 963 { 988 - strlcpy(acpi_video_backlight_string, str, 964 + strscpy(acpi_video_backlight_string, str, 989 965 sizeof(acpi_video_backlight_string)); 990 966 return 1; 991 967 }
+1
drivers/acpi/x86/apple.c
··· 8 8 #include <linux/bitmap.h> 9 9 #include <linux/platform_data/x86/apple.h> 10 10 #include <linux/uuid.h> 11 + #include "../internal.h" 11 12 12 13 /* Apple _DSM device properties GUID */ 13 14 static const guid_t apple_prp_guid =
+123 -24
drivers/acpi/x86/s2idle.c
··· 17 17 18 18 #include <linux/acpi.h> 19 19 #include <linux/device.h> 20 + #include <linux/dmi.h> 20 21 #include <linux/suspend.h> 21 22 22 23 #include "../sleep.h" ··· 27 26 static bool sleep_no_lps0 __read_mostly; 28 27 module_param(sleep_no_lps0, bool, 0644); 29 28 MODULE_PARM_DESC(sleep_no_lps0, "Do not use the special LPS0 device interface"); 29 + 30 + static bool prefer_microsoft_dsm_guid __read_mostly; 31 + module_param(prefer_microsoft_dsm_guid, bool, 0644); 32 + MODULE_PARM_DESC(prefer_microsoft_dsm_guid, "Prefer using Microsoft GUID in LPS0 device _DSM evaluation"); 30 33 31 34 static const struct acpi_device_id lps0_device_ids[] = { 32 35 {"PNP0D80", }, ··· 368 363 return ret; 369 364 } 370 365 366 + struct amd_lps0_hid_device_data { 367 + const unsigned int rev_id; 368 + const bool check_off_by_one; 369 + const bool prefer_amd_guid; 370 + }; 371 + 372 + static const struct amd_lps0_hid_device_data amd_picasso = { 373 + .rev_id = 0, 374 + .check_off_by_one = true, 375 + .prefer_amd_guid = false, 376 + }; 377 + 378 + static const struct amd_lps0_hid_device_data amd_cezanne = { 379 + .rev_id = 0, 380 + .check_off_by_one = false, 381 + .prefer_amd_guid = false, 382 + }; 383 + 384 + static const struct amd_lps0_hid_device_data amd_rembrandt = { 385 + .rev_id = 2, 386 + .check_off_by_one = false, 387 + .prefer_amd_guid = true, 388 + }; 389 + 390 + static const struct acpi_device_id amd_hid_ids[] = { 391 + {"AMD0004", (kernel_ulong_t)&amd_picasso, }, 392 + {"AMD0005", (kernel_ulong_t)&amd_picasso, }, 393 + {"AMDI0005", (kernel_ulong_t)&amd_picasso, }, 394 + {"AMDI0006", (kernel_ulong_t)&amd_cezanne, }, 395 + {"AMDI0007", (kernel_ulong_t)&amd_rembrandt, }, 396 + {} 397 + }; 398 + 399 + static int lps0_prefer_microsoft(const struct dmi_system_id *id) 400 + { 401 + pr_debug("Preferring Microsoft GUID.\n"); 402 + prefer_microsoft_dsm_guid = true; 403 + return 0; 404 + } 405 + 406 + static const struct dmi_system_id s2idle_dmi_table[] __initconst = { 407 + { 408 + /* 409 + * ASUS TUF Gaming A17 FA707RE 410 + * https://bugzilla.kernel.org/show_bug.cgi?id=216101 411 + */ 412 + .callback = lps0_prefer_microsoft, 413 + .matches = { 414 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 415 + DMI_MATCH(DMI_PRODUCT_NAME, "ASUS TUF Gaming A17"), 416 + }, 417 + }, 418 + { 419 + /* ASUS ROG Zephyrus G14 (2022) */ 420 + .callback = lps0_prefer_microsoft, 421 + .matches = { 422 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 423 + DMI_MATCH(DMI_PRODUCT_NAME, "ROG Zephyrus G14 GA402"), 424 + }, 425 + }, 426 + { 427 + /* 428 + * Lenovo Yoga Slim 7 Pro X 14ARH7 429 + * https://bugzilla.kernel.org/show_bug.cgi?id=216473 : 82V2 430 + * https://bugzilla.kernel.org/show_bug.cgi?id=216438 : 82TL 431 + */ 432 + .callback = lps0_prefer_microsoft, 433 + .matches = { 434 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 435 + DMI_MATCH(DMI_PRODUCT_NAME, "82"), 436 + }, 437 + }, 438 + { 439 + /* 440 + * ASUSTeK COMPUTER INC. ROG Flow X13 GV301RE_GV301RE 441 + * https://gitlab.freedesktop.org/drm/amd/-/issues/2148 442 + */ 443 + .callback = lps0_prefer_microsoft, 444 + .matches = { 445 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 446 + DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X13 GV301"), 447 + }, 448 + }, 449 + { 450 + /* 451 + * ASUSTeK COMPUTER INC. ROG Flow X16 GV601RW_GV601RW 452 + * https://gitlab.freedesktop.org/drm/amd/-/issues/2148 453 + */ 454 + .callback = lps0_prefer_microsoft, 455 + .matches = { 456 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 457 + DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow X16 GV601"), 458 + }, 459 + }, 460 + {} 461 + }; 462 + 371 463 static int lps0_device_attach(struct acpi_device *adev, 372 464 const struct acpi_device_id *not_used) 373 465 { 374 466 if (lps0_device_handle) 375 467 return 0; 376 468 469 + lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle, 470 + ACPI_LPS0_DSM_UUID_MICROSOFT, 0, 471 + &lps0_dsm_guid_microsoft); 377 472 if (acpi_s2idle_vendor_amd()) { 378 - /* AMD0004, AMD0005, AMDI0005: 379 - * - Should use rev_id 0x0 380 - * - function mask > 0x3: Should use AMD method, but has off by one bug 381 - * - function mask = 0x3: Should use Microsoft method 382 - * AMDI0006: 383 - * - should use rev_id 0x0 384 - * - function mask = 0x3: Should use Microsoft method 385 - * AMDI0007: 386 - * - Should use rev_id 0x2 387 - * - Should only use AMD method 388 - */ 389 - const char *hid = acpi_device_hid(adev); 390 - rev_id = strcmp(hid, "AMDI0007") ? 0 : 2; 473 + static const struct acpi_device_id *dev_id; 474 + const struct amd_lps0_hid_device_data *data; 475 + 476 + for (dev_id = &amd_hid_ids[0]; dev_id->id[0]; dev_id++) 477 + if (acpi_dev_hid_uid_match(adev, dev_id->id, NULL)) 478 + break; 479 + if (dev_id->id[0]) 480 + data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data; 481 + else 482 + data = &amd_rembrandt; 483 + rev_id = data->rev_id; 391 484 lps0_dsm_func_mask = validate_dsm(adev->handle, 392 485 ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid); 393 - lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle, 394 - ACPI_LPS0_DSM_UUID_MICROSOFT, 0, 395 - &lps0_dsm_guid_microsoft); 396 - if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") || 397 - !strcmp(hid, "AMD0005") || 398 - !strcmp(hid, "AMDI0005"))) { 486 + if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) { 399 487 lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1; 400 488 acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n", 401 489 ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask); 402 - } else if (lps0_dsm_func_mask_microsoft > 0 && 403 - (!strcmp(hid, "AMDI0007") || 404 - !strcmp(hid, "AMDI0008"))) { 490 + } else if (lps0_dsm_func_mask_microsoft > 0 && data->prefer_amd_guid && 491 + !prefer_microsoft_dsm_guid) { 405 492 lps0_dsm_func_mask_microsoft = -EINVAL; 406 493 acpi_handle_debug(adev->handle, "_DSM Using AMD method\n"); 407 494 } ··· 501 404 rev_id = 1; 502 405 lps0_dsm_func_mask = validate_dsm(adev->handle, 503 406 ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid); 504 - lps0_dsm_func_mask_microsoft = -EINVAL; 407 + if (!prefer_microsoft_dsm_guid) 408 + lps0_dsm_func_mask_microsoft = -EINVAL; 505 409 } 506 410 507 411 if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0) ··· 631 533 .end = acpi_s2idle_end, 632 534 }; 633 535 634 - void acpi_s2idle_setup(void) 536 + void __init acpi_s2idle_setup(void) 635 537 { 538 + dmi_check_system(s2idle_dmi_table); 636 539 acpi_scan_add_handler(&lps0_handler); 637 540 s2idle_set_ops(&acpi_s2idle_ops_lps0); 638 541 }
+28 -5
drivers/acpi/x86/utils.c
··· 207 207 {} 208 208 }; 209 209 210 + static const struct dmi_system_id force_storage_d3_dmi[] = { 211 + { 212 + /* 213 + * _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME 214 + * but .NVME is needed to get StorageD3Enable node 215 + * https://bugzilla.kernel.org/show_bug.cgi?id=216440 216 + */ 217 + .matches = { 218 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 219 + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"), 220 + } 221 + }, 222 + {} 223 + }; 224 + 210 225 bool force_storage_d3(void) 211 226 { 212 - return x86_match_cpu(storage_d3_cpu_ids); 227 + const struct dmi_system_id *dmi_id = dmi_first_match(force_storage_d3_dmi); 228 + 229 + return dmi_id || x86_match_cpu(storage_d3_cpu_ids); 213 230 } 214 231 215 232 /* ··· 368 351 struct acpi_device *adev = ACPI_COMPANION(controller_parent); 369 352 const struct dmi_system_id *dmi_id; 370 353 long quirks = 0; 354 + u64 uid; 355 + int ret; 371 356 372 357 *skip = false; 373 358 374 - /* !dev_is_platform() to not match on PNP enumerated debug UARTs */ 375 - if (!adev || !adev->pnp.unique_id || !dev_is_platform(controller_parent)) 359 + ret = acpi_dev_uid_to_integer(adev, &uid); 360 + if (ret) 361 + return 0; 362 + 363 + /* to not match on PNP enumerated debug UARTs */ 364 + if (!dev_is_platform(controller_parent)) 376 365 return 0; 377 366 378 367 dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids); ··· 386 363 quirks = (unsigned long)dmi_id->driver_data; 387 364 388 365 if (quirks & ACPI_QUIRK_UART1_TTY_UART2_SKIP) { 389 - if (!strcmp(adev->pnp.unique_id, "1")) 366 + if (uid == 1) 390 367 return -ENODEV; /* Create tty cdev instead of serdev */ 391 368 392 - if (!strcmp(adev->pnp.unique_id, "2")) 369 + if (uid == 2) 393 370 *skip = true; 394 371 } 395 372
+1 -1
drivers/base/arch_topology.c
··· 353 353 struct cppc_perf_caps perf_caps; 354 354 int cpu; 355 355 356 - if (likely(acpi_disabled || !acpi_cpc_valid())) 356 + if (likely(!acpi_cpc_valid())) 357 357 return; 358 358 359 359 raw_capacity = kcalloc(num_possible_cpus(), sizeof(*raw_capacity),
+9 -4
drivers/clk/clk-tps68470.c
··· 200 200 .flags = CLK_SET_RATE_GATE, 201 201 }; 202 202 struct tps68470_clkdata *tps68470_clkdata; 203 + struct tps68470_clk_consumer *consumer; 203 204 int ret; 205 + int i; 204 206 205 207 tps68470_clkdata = devm_kzalloc(&pdev->dev, sizeof(*tps68470_clkdata), 206 208 GFP_KERNEL); ··· 225 223 return ret; 226 224 227 225 if (pdata) { 228 - ret = devm_clk_hw_register_clkdev(&pdev->dev, 229 - &tps68470_clkdata->clkout_hw, 230 - pdata->consumer_con_id, 231 - pdata->consumer_dev_name); 226 + for (i = 0; i < pdata->n_consumers; i++) { 227 + consumer = &pdata->consumers[i]; 228 + ret = devm_clk_hw_register_clkdev(&pdev->dev, 229 + &tps68470_clkdata->clkout_hw, 230 + consumer->consumer_con_id, 231 + consumer->consumer_dev_name); 232 + } 232 233 } 233 234 234 235 return ret;
+1 -1
drivers/cpufreq/amd-pstate.c
··· 673 673 return -ENODEV; 674 674 675 675 if (!acpi_cpc_valid()) { 676 - pr_debug("the _CPC object is not present in SBIOS\n"); 676 + pr_warn_once("the _CPC object is not present in SBIOS or ACPI disabled\n"); 677 677 return -ENODEV; 678 678 } 679 679
+22 -5
drivers/cpufreq/cppc_cpufreq.c
··· 63 63 64 64 static struct cpufreq_driver cppc_cpufreq_driver; 65 65 66 + static enum { 67 + FIE_UNSET = -1, 68 + FIE_ENABLED, 69 + FIE_DISABLED 70 + } fie_disabled = FIE_UNSET; 71 + 66 72 #ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE 73 + module_param(fie_disabled, int, 0444); 74 + MODULE_PARM_DESC(fie_disabled, "Disable Frequency Invariance Engine (FIE)"); 67 75 68 76 /* Frequency invariance support */ 69 77 struct cppc_freq_invariance { ··· 166 158 struct cppc_freq_invariance *cppc_fi; 167 159 int cpu, ret; 168 160 169 - if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) 161 + if (fie_disabled) 170 162 return; 171 163 172 164 for_each_cpu(cpu, policy->cpus) { ··· 207 199 struct cppc_freq_invariance *cppc_fi; 208 200 int cpu; 209 201 210 - if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) 202 + if (fie_disabled) 211 203 return; 212 204 213 205 /* policy->cpus will be empty here, use related_cpus instead */ ··· 237 229 }; 238 230 int ret; 239 231 240 - if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) 232 + if (fie_disabled != FIE_ENABLED && fie_disabled != FIE_DISABLED) { 233 + fie_disabled = FIE_ENABLED; 234 + if (cppc_perf_ctrs_in_pcc()) { 235 + pr_info("FIE not enabled on systems with registers in PCC\n"); 236 + fie_disabled = FIE_DISABLED; 237 + } 238 + } 239 + 240 + if (fie_disabled) 241 241 return; 242 242 243 243 kworker_fie = kthread_create_worker(0, "cppc_fie"); ··· 263 247 264 248 static void cppc_freq_invariance_exit(void) 265 249 { 266 - if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate) 250 + if (fie_disabled) 267 251 return; 268 252 269 253 kthread_destroy_worker(kworker_fie); ··· 952 936 wa_info[i].oem_revision == tbl->oem_revision) { 953 937 /* Overwrite the get() callback */ 954 938 cppc_cpufreq_driver.get = hisi_cppc_cpufreq_get_rate; 939 + fie_disabled = FIE_DISABLED; 955 940 break; 956 941 } 957 942 } ··· 964 947 { 965 948 int ret; 966 949 967 - if ((acpi_disabled) || !acpi_cpc_valid()) 950 + if (!acpi_cpc_valid()) 968 951 return -ENODEV; 969 952 970 953 cppc_check_hisi_workaround();
+6 -4
drivers/firmware/efi/dev-path-parser.c
··· 15 15 static long __init parse_acpi_path(const struct efi_dev_path *node, 16 16 struct device *parent, struct device **child) 17 17 { 18 - char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */ 19 18 struct acpi_device *adev; 20 19 struct device *phys_dev; 20 + char hid[ACPI_ID_LEN]; 21 + u64 uid; 22 + int ret; 21 23 22 24 if (node->header.length != 12) 23 25 return -EINVAL; ··· 29 27 'A' + ((node->acpi.hid >> 5) & 0x1f) - 1, 30 28 'A' + ((node->acpi.hid >> 0) & 0x1f) - 1, 31 29 node->acpi.hid >> 16); 32 - sprintf(uid, "%u", node->acpi.uid); 33 30 34 31 for_each_acpi_dev_match(adev, hid, NULL, -1) { 35 - if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid)) 32 + ret = acpi_dev_uid_to_integer(adev, &uid); 33 + if (ret == 0 && node->acpi.uid == uid) 36 34 break; 37 - if (!adev->pnp.unique_id && node->acpi.uid == 0) 35 + if (ret == -ENODATA && node->acpi.uid == 0) 38 36 break; 39 37 } 40 38 if (!adev)
+2 -1
drivers/hv/vmbus_drv.c
··· 2453 2453 * Some ancestor of the vmbus acpi device (Gen1 or Gen2 2454 2454 * firmware) is the VMOD that has the mmio ranges. Get that. 2455 2455 */ 2456 - for (ancestor = device->parent; ancestor; ancestor = ancestor->parent) { 2456 + for (ancestor = acpi_dev_parent(device); ancestor; 2457 + ancestor = acpi_dev_parent(ancestor)) { 2457 2458 result = acpi_walk_resources(ancestor->handle, METHOD_NAME__CRS, 2458 2459 vmbus_walk_resources, NULL); 2459 2460
+1 -1
drivers/hwmon/acpi_power_meter.c
··· 598 598 continue; 599 599 600 600 /* Create a symlink to domain objects */ 601 - obj = acpi_bus_get_acpi_device(element->reference.handle); 601 + obj = acpi_get_acpi_dev(element->reference.handle); 602 602 resource->domain_devices[i] = obj; 603 603 if (!obj) 604 604 continue;
+9 -18
drivers/i2c/busses/i2c-amd-mp2-plat.c
··· 244 244 245 245 static int i2c_amd_probe(struct platform_device *pdev) 246 246 { 247 + struct device *dev = &pdev->dev; 247 248 int ret; 248 249 struct amd_i2c_dev *i2c_dev; 249 - struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); 250 250 struct amd_mp2_dev *mp2_dev; 251 - const char *uid; 251 + u64 uid; 252 252 253 - if (!adev) 254 - return -ENODEV; 253 + ret = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid); 254 + if (ret) 255 + return dev_err_probe(dev, ret, "missing UID/bus id!\n"); 256 + if (uid >= 2) 257 + return dev_err_probe(dev, -EINVAL, "incorrect UID/bus id \"%llu\"!\n", uid); 258 + dev_dbg(dev, "bus id is %llu\n", uid); 255 259 256 260 /* The ACPI namespace doesn't contain information about which MP2 PCI 257 261 * device an AMDI0011 ACPI device is related to, so assume that there's ··· 270 266 if (!i2c_dev) 271 267 return -ENOMEM; 272 268 269 + i2c_dev->common.bus_id = uid; 273 270 i2c_dev->common.mp2_dev = mp2_dev; 274 271 i2c_dev->pdev = pdev; 275 272 platform_set_drvdata(pdev, i2c_dev); ··· 280 275 i2c_dev->common.suspend = &i2c_amd_suspend; 281 276 i2c_dev->common.resume = &i2c_amd_resume; 282 277 #endif 283 - 284 - uid = adev->pnp.unique_id; 285 - if (!uid) { 286 - dev_err(&pdev->dev, "missing UID/bus id!\n"); 287 - return -EINVAL; 288 - } else if (strcmp(uid, "0") == 0) { 289 - i2c_dev->common.bus_id = 0; 290 - } else if (strcmp(uid, "1") == 0) { 291 - i2c_dev->common.bus_id = 1; 292 - } else { 293 - dev_err(&pdev->dev, "incorrect UID/bus id \"%s\"!\n", uid); 294 - return -EINVAL; 295 - } 296 - dev_dbg(&pdev->dev, "bus id is %u\n", i2c_dev->common.bus_id); 297 278 298 279 /* Register the adapter */ 299 280 amd_mp2_pm_runtime_get(mp2_dev);
+6 -14
drivers/i2c/busses/i2c-mlxbf.c
··· 2215 2215 static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv) 2216 2216 { 2217 2217 const struct acpi_device_id *aid; 2218 - struct acpi_device *adev; 2219 - unsigned long bus_id = 0; 2220 - const char *uid; 2218 + u64 bus_id; 2221 2219 int ret; 2222 2220 2223 2221 if (acpi_disabled) 2224 2222 return -ENOENT; 2225 - 2226 - adev = ACPI_COMPANION(dev); 2227 - if (!adev) 2228 - return -ENXIO; 2229 2223 2230 2224 aid = acpi_match_device(mlxbf_i2c_acpi_ids, dev); 2231 2225 if (!aid) ··· 2227 2233 2228 2234 priv->chip = (struct mlxbf_i2c_chip_info *)aid->driver_data; 2229 2235 2230 - uid = acpi_device_uid(adev); 2231 - if (!uid || !(*uid)) { 2236 + ret = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &bus_id); 2237 + if (ret) { 2232 2238 dev_err(dev, "Cannot retrieve UID\n"); 2233 - return -ENODEV; 2239 + return ret; 2234 2240 } 2235 2241 2236 - ret = kstrtoul(uid, 0, &bus_id); 2237 - if (!ret) 2238 - priv->bus = bus_id; 2242 + priv->bus = bus_id; 2239 2243 2240 - return ret; 2244 + return 0; 2241 2245 } 2242 2246 #else 2243 2247 static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
+2 -2
drivers/perf/arm_dsu_pmu.c
··· 639 639 static int dsu_pmu_acpi_get_cpus(struct device *dev, cpumask_t *mask) 640 640 { 641 641 #ifdef CONFIG_ACPI 642 + struct acpi_device *parent_adev = acpi_dev_parent(ACPI_COMPANION(dev)); 642 643 int cpu; 643 644 644 645 /* ··· 654 653 continue; 655 654 656 655 acpi_dev = ACPI_COMPANION(cpu_dev); 657 - if (acpi_dev && 658 - acpi_dev->parent == ACPI_COMPANION(dev)->parent) 656 + if (acpi_dev && acpi_dev_parent(acpi_dev) == parent_adev) 659 657 cpumask_set_cpu(cpu, mask); 660 658 } 661 659 #endif
+5 -5
drivers/perf/qcom_l2_pmu.c
··· 840 840 { 841 841 struct platform_device *pdev = to_platform_device(dev->parent); 842 842 struct platform_device *sdev = to_platform_device(dev); 843 - struct acpi_device *adev = ACPI_COMPANION(dev); 844 843 struct l2cache_pmu *l2cache_pmu = data; 845 844 struct cluster_pmu *cluster; 846 - unsigned long fw_cluster_id; 845 + u64 fw_cluster_id; 847 846 int err; 848 847 int irq; 849 848 850 - if (!adev || kstrtoul(adev->pnp.unique_id, 10, &fw_cluster_id) < 0) { 849 + err = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &fw_cluster_id); 850 + if (err) { 851 851 dev_err(&pdev->dev, "unable to read ACPI uid\n"); 852 - return -ENODEV; 852 + return err; 853 853 } 854 854 855 855 cluster = devm_kzalloc(&pdev->dev, sizeof(*cluster), GFP_KERNEL); ··· 879 879 } 880 880 881 881 dev_info(&pdev->dev, 882 - "Registered L2 cache PMU cluster %ld\n", fw_cluster_id); 882 + "Registered L2 cache PMU cluster %lld\n", fw_cluster_id); 883 883 884 884 spin_lock_init(&cluster->pmu_lock); 885 885
+2 -1
drivers/perf/qcom_l3_pmu.c
··· 742 742 743 743 l3pmu = devm_kzalloc(&pdev->dev, sizeof(*l3pmu), GFP_KERNEL); 744 744 name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "l3cache_%s_%s", 745 - acpi_dev->parent->pnp.unique_id, acpi_dev->pnp.unique_id); 745 + acpi_dev_parent(acpi_dev)->pnp.unique_id, 746 + acpi_dev->pnp.unique_id); 746 747 if (!l3pmu || !name) 747 748 return -ENOMEM; 748 749
+1 -1
drivers/platform/x86/intel/int3472/common.c
··· 62 62 struct acpi_device *sensor; 63 63 int ret = 0; 64 64 65 - sensor = acpi_dev_get_first_consumer_dev(adev); 65 + sensor = acpi_dev_get_next_consumer_dev(adev, NULL); 66 66 if (!sensor) { 67 67 dev_err(dev, "INT3472 seems to have no dependents.\n"); 68 68 return -ENODEV;
+64 -12
drivers/platform/x86/intel/int3472/tps68470.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Author: Dan Scally <djrscally@gmail.com> */ 3 3 4 + #include <linux/acpi.h> 4 5 #include <linux/i2c.h> 5 6 #include <linux/kernel.h> 6 7 #include <linux/mfd/core.h> ··· 96 95 return DESIGNED_FOR_WINDOWS; 97 96 } 98 97 98 + /* 99 + * Return the size of the flexible array member, because we'll need that later 100 + * on to pass .pdata_size to cells. 101 + */ 102 + static int 103 + skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data **clk_pdata) 104 + { 105 + struct acpi_device *adev = ACPI_COMPANION(dev); 106 + struct acpi_device *consumer; 107 + unsigned int n_consumers = 0; 108 + const char *sensor_name; 109 + unsigned int i = 0; 110 + 111 + for_each_acpi_consumer_dev(adev, consumer) 112 + n_consumers++; 113 + 114 + if (!n_consumers) { 115 + dev_err(dev, "INT3472 seems to have no dependents\n"); 116 + return -ENODEV; 117 + } 118 + 119 + *clk_pdata = devm_kzalloc(dev, struct_size(*clk_pdata, consumers, n_consumers), 120 + GFP_KERNEL); 121 + if (!*clk_pdata) 122 + return -ENOMEM; 123 + 124 + (*clk_pdata)->n_consumers = n_consumers; 125 + i = 0; 126 + 127 + for_each_acpi_consumer_dev(adev, consumer) { 128 + sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT, 129 + acpi_dev_name(consumer)); 130 + if (!sensor_name) 131 + return -ENOMEM; 132 + 133 + (*clk_pdata)->consumers[i].consumer_dev_name = sensor_name; 134 + i++; 135 + } 136 + 137 + acpi_dev_put(consumer); 138 + 139 + return n_consumers; 140 + } 141 + 99 142 static int skl_int3472_tps68470_probe(struct i2c_client *client) 100 143 { 101 144 struct acpi_device *adev = ACPI_COMPANION(&client->dev); 102 145 const struct int3472_tps68470_board_data *board_data; 103 - struct tps68470_clk_platform_data clk_pdata = {}; 146 + struct tps68470_clk_platform_data *clk_pdata; 104 147 struct mfd_cell *cells; 105 148 struct regmap *regmap; 149 + int n_consumers; 106 150 int device_type; 107 151 int ret; 152 + int i; 108 153 109 - ret = skl_int3472_get_sensor_adev_and_name(&client->dev, NULL, 110 - &clk_pdata.consumer_dev_name); 111 - if (ret) 112 - return ret; 154 + n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata); 155 + if (n_consumers < 0) 156 + return n_consumers; 113 157 114 158 regmap = devm_regmap_init_i2c(client, &tps68470_regmap_config); 115 159 if (IS_ERR(regmap)) { ··· 188 142 * the clk + regulators must be ready when this happens. 189 143 */ 190 144 cells[0].name = "tps68470-clk"; 191 - cells[0].platform_data = &clk_pdata; 192 - cells[0].pdata_size = sizeof(clk_pdata); 145 + cells[0].platform_data = clk_pdata; 146 + cells[0].pdata_size = struct_size(clk_pdata, consumers, n_consumers); 193 147 cells[1].name = "tps68470-regulator"; 194 148 cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata; 195 149 cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data); 196 150 cells[2].name = "tps68470-gpio"; 197 151 198 - gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_table); 152 + for (i = 0; i < board_data->n_gpiod_lookups; i++) 153 + gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); 199 154 200 155 ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, 201 156 cells, TPS68470_WIN_MFD_CELL_COUNT, 202 157 NULL, 0, NULL); 203 158 kfree(cells); 204 159 205 - if (ret) 206 - gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_table); 160 + if (ret) { 161 + for (i = 0; i < board_data->n_gpiod_lookups; i++) 162 + gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); 163 + } 207 164 208 165 break; 209 166 case DESIGNED_FOR_CHROMEOS: ··· 230 181 static int skl_int3472_tps68470_remove(struct i2c_client *client) 231 182 { 232 183 const struct int3472_tps68470_board_data *board_data; 184 + int i; 233 185 234 186 board_data = int3472_tps68470_get_board_data(dev_name(&client->dev)); 235 - if (board_data) 236 - gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_table); 187 + if (board_data) { 188 + for (i = 0; i < board_data->n_gpiod_lookups; i++) 189 + gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); 190 + } 237 191 238 192 return 0; 239 193 }
+2 -1
drivers/platform/x86/intel/int3472/tps68470.h
··· 16 16 17 17 struct int3472_tps68470_board_data { 18 18 const char *dev_name; 19 - struct gpiod_lookup_table *tps68470_gpio_lookup_table; 20 19 const struct tps68470_regulator_platform_data *tps68470_regulator_pdata; 20 + unsigned int n_gpiod_lookups; 21 + struct gpiod_lookup_table *tps68470_gpio_lookup_tables[]; 21 22 }; 22 23 23 24 const struct int3472_tps68470_board_data *int3472_tps68470_get_board_data(const char *dev_name);
+51 -3
drivers/platform/x86/intel/int3472/tps68470_board_data.c
··· 30 30 static struct regulator_consumer_supply int347a_vsio_consumer_supplies[] = { 31 31 REGULATOR_SUPPLY("dovdd", "i2c-INT347A:00"), 32 32 REGULATOR_SUPPLY("vsio", "i2c-INT347A:00-VCM"), 33 + REGULATOR_SUPPLY("vddd", "i2c-INT347E:00"), 34 + }; 35 + 36 + static struct regulator_consumer_supply int347a_aux1_consumer_supplies[] = { 37 + REGULATOR_SUPPLY("vdda", "i2c-INT347E:00"), 38 + }; 39 + 40 + static struct regulator_consumer_supply int347a_aux2_consumer_supplies[] = { 41 + REGULATOR_SUPPLY("vdddo", "i2c-INT347E:00"), 33 42 }; 34 43 35 44 static const struct regulator_init_data surface_go_tps68470_core_reg_init_data = { ··· 95 86 .consumer_supplies = int347a_vsio_consumer_supplies, 96 87 }; 97 88 89 + static const struct regulator_init_data surface_go_tps68470_aux1_reg_init_data = { 90 + .constraints = { 91 + .min_uV = 2815200, 92 + .max_uV = 2815200, 93 + .apply_uV = 1, 94 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 95 + }, 96 + .num_consumer_supplies = ARRAY_SIZE(int347a_aux1_consumer_supplies), 97 + .consumer_supplies = int347a_aux1_consumer_supplies, 98 + }; 99 + 100 + static const struct regulator_init_data surface_go_tps68470_aux2_reg_init_data = { 101 + .constraints = { 102 + .min_uV = 1800600, 103 + .max_uV = 1800600, 104 + .apply_uV = 1, 105 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 106 + }, 107 + .num_consumer_supplies = ARRAY_SIZE(int347a_aux2_consumer_supplies), 108 + .consumer_supplies = int347a_aux2_consumer_supplies, 109 + }; 110 + 98 111 static const struct tps68470_regulator_platform_data surface_go_tps68470_pdata = { 99 112 .reg_init_data = { 100 113 [TPS68470_CORE] = &surface_go_tps68470_core_reg_init_data, ··· 124 93 [TPS68470_VCM] = &surface_go_tps68470_vcm_reg_init_data, 125 94 [TPS68470_VIO] = &surface_go_tps68470_vio_reg_init_data, 126 95 [TPS68470_VSIO] = &surface_go_tps68470_vsio_reg_init_data, 96 + [TPS68470_AUX1] = &surface_go_tps68470_aux1_reg_init_data, 97 + [TPS68470_AUX2] = &surface_go_tps68470_aux2_reg_init_data, 127 98 }, 128 99 }; 129 100 130 - static struct gpiod_lookup_table surface_go_tps68470_gpios = { 101 + static struct gpiod_lookup_table surface_go_int347a_gpios = { 131 102 .dev_id = "i2c-INT347A:00", 132 103 .table = { 133 104 GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW), ··· 138 105 } 139 106 }; 140 107 108 + static struct gpiod_lookup_table surface_go_int347e_gpios = { 109 + .dev_id = "i2c-INT347E:00", 110 + .table = { 111 + GPIO_LOOKUP("tps68470-gpio", 5, "enable", GPIO_ACTIVE_HIGH), 112 + { } 113 + } 114 + }; 115 + 141 116 static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = { 142 117 .dev_name = "i2c-INT3472:05", 143 - .tps68470_gpio_lookup_table = &surface_go_tps68470_gpios, 144 118 .tps68470_regulator_pdata = &surface_go_tps68470_pdata, 119 + .n_gpiod_lookups = 2, 120 + .tps68470_gpio_lookup_tables = { 121 + &surface_go_int347a_gpios, 122 + &surface_go_int347e_gpios, 123 + }, 145 124 }; 146 125 147 126 static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data = { 148 127 .dev_name = "i2c-INT3472:01", 149 - .tps68470_gpio_lookup_table = &surface_go_tps68470_gpios, 150 128 .tps68470_regulator_pdata = &surface_go_tps68470_pdata, 129 + .n_gpiod_lookups = 1, 130 + .tps68470_gpio_lookup_tables = { 131 + &surface_go_int347a_gpios 132 + }, 151 133 }; 152 134 153 135 static const struct dmi_system_id int3472_tps68470_board_data_table[] = {
-1
drivers/pnp/pnpbios/pnpbios.h
··· 153 153 extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node); 154 154 extern int pnpbios_read_resources_from_node(struct pnp_dev *dev, struct pnp_bios_node *node); 155 155 extern int pnpbios_write_resources_to_node(struct pnp_dev *dev, struct pnp_bios_node *node); 156 - extern void pnpid32_to_pnpid(u32 id, char *str); 157 156 158 157 extern void pnpbios_print_status(const char * module, u16 status); 159 158 extern void pnpbios_calls_init(union pnp_bios_install_struct * header);
+10 -27
drivers/spi/spi-pxa2xx.c
··· 1441 1441 }; 1442 1442 MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match); 1443 1443 1444 - #ifdef CONFIG_ACPI 1445 - 1446 - static int pxa2xx_spi_get_port_id(struct device *dev) 1447 - { 1448 - struct acpi_device *adev; 1449 - unsigned int devid; 1450 - int port_id = -1; 1451 - 1452 - adev = ACPI_COMPANION(dev); 1453 - if (adev && adev->pnp.unique_id && 1454 - !kstrtouint(adev->pnp.unique_id, 0, &devid)) 1455 - port_id = devid; 1456 - return port_id; 1457 - } 1458 - 1459 - #else /* !CONFIG_ACPI */ 1460 - 1461 - static int pxa2xx_spi_get_port_id(struct device *dev) 1462 - { 1463 - return -1; 1464 - } 1465 - 1466 - #endif /* CONFIG_ACPI */ 1467 - 1468 - 1469 1444 #ifdef CONFIG_PCI 1470 1445 1471 1446 static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) ··· 1454 1479 pxa2xx_spi_init_pdata(struct platform_device *pdev) 1455 1480 { 1456 1481 struct pxa2xx_spi_controller *pdata; 1482 + struct device *dev = &pdev->dev; 1483 + struct device *parent = dev->parent; 1457 1484 struct ssp_device *ssp; 1458 1485 struct resource *res; 1459 - struct device *parent = pdev->dev.parent; 1460 1486 struct pci_dev *pcidev = dev_is_pci(parent) ? to_pci_dev(parent) : NULL; 1461 1487 const struct pci_device_id *pcidev_id = NULL; 1462 1488 enum pxa_ssp_type type; 1463 1489 const void *match; 1490 + int status; 1491 + u64 uid; 1464 1492 1465 1493 if (pcidev) 1466 1494 pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev); ··· 1507 1529 1508 1530 ssp->type = type; 1509 1531 ssp->dev = &pdev->dev; 1510 - ssp->port_id = pxa2xx_spi_get_port_id(&pdev->dev); 1532 + 1533 + status = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid); 1534 + if (status) 1535 + ssp->port_id = -1; 1536 + else 1537 + ssp->port_id = uid; 1511 1538 1512 1539 pdata->is_slave = device_property_read_bool(&pdev->dev, "spi-slave"); 1513 1540 pdata->num_chipselect = 1;
+1 -1
drivers/spi/spi.c
··· 4374 4374 4375 4375 switch (value) { 4376 4376 case ACPI_RECONFIG_DEVICE_ADD: 4377 - ctlr = acpi_spi_find_controller_by_adev(adev->parent); 4377 + ctlr = acpi_spi_find_controller_by_adev(acpi_dev_parent(adev)); 4378 4378 if (!ctlr) 4379 4379 break; 4380 4380
+1 -1
drivers/thunderbolt/acpi.c
··· 42 42 */ 43 43 dev = acpi_get_first_physical_node(adev); 44 44 while (!dev) { 45 - adev = adev->parent; 45 + adev = acpi_dev_parent(adev); 46 46 if (!adev) 47 47 break; 48 48 dev = acpi_get_first_physical_node(adev);
+1 -10
drivers/usb/typec/mux/intel_pmc_mux.c
··· 569 569 return ret; 570 570 } 571 571 572 - static int is_memory(struct acpi_resource *res, void *data) 573 - { 574 - struct resource_win win = {}; 575 - struct resource *r = &win.res; 576 - 577 - return !(acpi_dev_resource_memory(res, r) || 578 - acpi_dev_resource_address_space(res, &win)); 579 - } 580 - 581 572 /* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */ 582 573 static const struct acpi_device_id iom_acpi_ids[] = { 583 574 /* TigerLake */ ··· 602 611 return -ENODEV; 603 612 604 613 INIT_LIST_HEAD(&resource_list); 605 - ret = acpi_dev_get_resources(adev, &resource_list, is_memory, NULL); 614 + ret = acpi_dev_get_memory_resources(adev, &resource_list); 606 615 if (ret < 0) 607 616 return ret; 608 617
+27 -7
include/acpi/acpi_bus.h
··· 365 365 int device_type; 366 366 acpi_handle handle; /* no handle for fixed hardware */ 367 367 struct fwnode_handle fwnode; 368 - struct acpi_device *parent; 369 368 struct list_head wakeup_list; 370 369 struct list_head del_list; 371 370 struct acpi_device_status status; ··· 457 458 #define to_acpi_device(d) container_of(d, struct acpi_device, dev) 458 459 #define to_acpi_driver(d) container_of(d, struct acpi_driver, drv) 459 460 461 + static inline struct acpi_device *acpi_dev_parent(struct acpi_device *adev) 462 + { 463 + if (adev->dev.parent) 464 + return to_acpi_device(adev->dev.parent); 465 + 466 + return NULL; 467 + } 468 + 460 469 static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta) 461 470 { 462 471 *((u32 *)&adev->status) = sta; ··· 519 512 * External Functions 520 513 */ 521 514 522 - struct acpi_device *acpi_fetch_acpi_dev(acpi_handle handle); 523 515 acpi_status acpi_bus_get_status_handle(acpi_handle handle, 524 516 unsigned long long *sta); 525 517 int acpi_bus_get_status(struct acpi_device *device); ··· 619 613 int acpi_iommu_fwspec_init(struct device *dev, u32 id, 620 614 struct fwnode_handle *fwnode, 621 615 const struct iommu_ops *ops); 622 - int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset, 623 - u64 *size); 616 + int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map); 624 617 int acpi_dma_configure_id(struct device *dev, enum dev_dma_attr attr, 625 618 const u32 *input_id); 626 619 static inline int acpi_dma_configure(struct device *dev, ··· 738 733 } 739 734 740 735 bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2); 736 + int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer); 741 737 742 738 void acpi_dev_clear_dependencies(struct acpi_device *supplier); 743 739 bool acpi_dev_ready_for_enumeration(const struct acpi_device *device); 744 - struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier); 740 + struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier, 741 + struct acpi_device *start); 742 + 743 + /** 744 + * for_each_acpi_consumer_dev - iterate over the consumer ACPI devices for a 745 + * given supplier 746 + * @supplier: Pointer to the supplier's ACPI device 747 + * @consumer: Pointer to &struct acpi_device to hold the consumer, initially NULL 748 + */ 749 + #define for_each_acpi_consumer_dev(supplier, consumer) \ 750 + for (consumer = acpi_dev_get_next_consumer_dev(supplier, NULL); \ 751 + consumer; \ 752 + consumer = acpi_dev_get_next_consumer_dev(supplier, consumer)) 753 + 745 754 struct acpi_device * 746 755 acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const char *uid, s64 hrv); 747 756 struct acpi_device * ··· 786 767 put_device(&adev->dev); 787 768 } 788 769 789 - struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle); 770 + struct acpi_device *acpi_fetch_acpi_dev(acpi_handle handle); 771 + struct acpi_device *acpi_get_acpi_dev(acpi_handle handle); 790 772 791 - static inline void acpi_bus_put_acpi_device(struct acpi_device *adev) 773 + static inline void acpi_put_acpi_dev(struct acpi_device *adev) 792 774 { 793 775 acpi_dev_put(adev); 794 776 }
+5
include/acpi/cppc_acpi.h
··· 140 140 extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); 141 141 extern int cppc_set_enable(int cpu, bool enable); 142 142 extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps); 143 + extern bool cppc_perf_ctrs_in_pcc(void); 143 144 extern bool acpi_cpc_valid(void); 144 145 extern bool cppc_allow_fast_switch(void); 145 146 extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data); ··· 173 172 static inline int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps) 174 173 { 175 174 return -ENOTSUPP; 175 + } 176 + static inline bool cppc_perf_ctrs_in_pcc(void) 177 + { 178 + return false; 176 179 } 177 180 static inline bool acpi_cpc_valid(void) 178 181 {
+13 -5
include/linux/acpi.h
··· 279 279 280 280 void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); 281 281 282 + #if defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH) 283 + void acpi_arch_dma_setup(struct device *dev); 284 + #else 285 + static inline void acpi_arch_dma_setup(struct device *dev) { } 286 + #endif 287 + 282 288 #ifdef CONFIG_ARM64 283 289 void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa); 284 - void acpi_arch_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size); 285 290 #else 286 291 static inline void 287 292 acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { } 288 - static inline void 289 - acpi_arch_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size) { } 290 293 #endif 291 294 292 295 int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); ··· 509 506 void *preproc_data); 510 507 int acpi_dev_get_dma_resources(struct acpi_device *adev, 511 508 struct list_head *list); 509 + int acpi_dev_get_memory_resources(struct acpi_device *adev, struct list_head *list); 512 510 int acpi_dev_filter_resource_type(struct acpi_resource *ares, 513 511 unsigned long types); 514 512 ··· 802 798 return false; 803 799 } 804 800 801 + static inline int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer) 802 + { 803 + return -ENODEV; 804 + } 805 + 805 806 static inline struct acpi_device * 806 807 acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) 807 808 { ··· 986 977 return DEV_DMA_NOT_SUPPORTED; 987 978 } 988 979 989 - static inline int acpi_dma_get_range(struct device *dev, u64 *dma_addr, 990 - u64 *offset, u64 *size) 980 + static inline int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map) 991 981 { 992 982 return -ENODEV; 993 983 }
+6 -1
include/linux/platform_data/tps68470.h
··· 27 27 const struct regulator_init_data *reg_init_data[TPS68470_NUM_REGULATORS]; 28 28 }; 29 29 30 - struct tps68470_clk_platform_data { 30 + struct tps68470_clk_consumer { 31 31 const char *consumer_dev_name; 32 32 const char *consumer_con_id; 33 + }; 34 + 35 + struct tps68470_clk_platform_data { 36 + unsigned int n_consumers; 37 + struct tps68470_clk_consumer consumers[]; 33 38 }; 34 39 35 40 #endif
+1 -1
tools/power/acpi/tools/pfrut/pfrut.c
··· 190 190 void *addr_map_capsule; 191 191 struct stat st; 192 192 char *log_buf; 193 - int ret = 0; 193 + int ret; 194 194 195 195 if (getuid() != 0) { 196 196 printf("Please run the tool as root - Exiting.\n");