diff options
author | Linus Torvalds | 2022-08-02 11:12:25 -0700 |
---|---|---|
committer | Linus Torvalds | 2022-08-02 11:12:25 -0700 |
commit | 8fa0db3a9b8ef310eb40cf91481141ece084f584 (patch) | |
tree | d78fe991dc58ca33a755d37ae1b753322817e99d /drivers/acpi/bus.c | |
parent | 64ae88ff48cb5b3cc7b7aea97241a3e940085bf7 (diff) | |
parent | 6352f3478a95cc413ecfee4fdb3300009fd3679a (diff) |
Merge tag 'acpi-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki:
"These rework the handling of ACPI device objects to use the driver
core facilities for managing child ones instead of some questionable
home-grown ways without the requisite locking and reference counting,
clean up the EC driver, improve suspend-to-idle handling on x86, add
some systems to the ACPI backlight quirk list, fix some assorted
issues, clean up code and improve documentation.
Specifics:
- Use facilities provided by the driver core and some additional
helpers to handle the children of a given ACPI device object in
multiple places instead of using the children and node list heads
in struct acpi_device which is error prone (Rafael Wysocki).
- Fix ACPI-related device reference counting issue in the hisi_lpc
bus driver (Yang Yingliang).
- Drop the children and node list heads that are not needed any more
from struct acpi_device (Rafael Wysocki).
- Drop driver member from struct acpi_device (Uwe Kleine-König).
- Drop redundant check from acpi_device_remove() (Uwe Kleine-König).
- Prepare the CPPC library for handling backwards-compatible future
_CPC return package formats gracefully (Rafael Wysocki).
- Clean up the ACPI EC driver after previous changes in it (Hans de
Goede).
- Drop leftover acpi_processor_get_limit_info() declaration (Riwen
Lu).
- Split out thermal initialization from ACPI PSS (Riwen Lu).
- Annotate more functions in the ACPI CPU idle driver to live in the
cpuidle section (Guilherme G. Piccoli).
- Fix _EINJ vs "special purpose" EFI memory regions (Dan Williams).
- Implement a better fix to avoid spamming the console with old error
logs (Tony Luck).
- Fix typo in a comment in the APEI code (Xiang wangx).
- Save NVS memory during transitions into S3 on Lenovo G40-45 (Manyi
Li).
- Add support for upcoming AMD uPEP device ID AMDI008 to the ACPI
suspend-to-idle driver for x86 platforms (Shyam Sundar S K).
- Clean up checks related to the ACPI_FADT_LOW_POWER_S0 platform flag
in the LPIT table driver and the suspend-to-idle driver for x86
platforms (Rafael Wysocki).
- Print information messages regarding declared LPS0 idle support in
the platform firmware (Rafael Wysocki).
- Fix missing check in register_device_clock() in the ACPI driver for
Intel SoCs (huhai).
- Fix ACS setup in the VIOT table parser (Eric Auger).
- Skip IRQ override on AMD Zen platforms where it's harmful
(Chuanhong Guo).
- Use native backlight on Dell Inspiron N4010 (Hans de Goede).
- Use native backlight on some TongFang devices (Werner Sembach).
- Drop X86 dependency from the ACPI backlight driver Kconfig (Riwen
Lu).
- Shorten the quirk list in the ACPI backlight driver by identifying
Clevo by board_name only (Werner Sembach).
- Remove useless NULL pointer checks from 2 ACPI PCI link management
functions (Andrey Strachuk).
- Fix obsolete example in the ACPI EINJ documentation (Qifu Zhang).
- Update links and references to _DSD-related documents (Sudeep
Holla)"
* tag 'acpi-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (46 commits)
ACPI/PCI: Remove useless NULL pointer checks
ACPI: CPPC: Do not prevent CPPC from working in the future
ACPI: PM: x86: Print messages regarding LPS0 idle support
ACPI: resource: skip IRQ override on AMD Zen platforms
Documentation: ACPI: EINJ: Fix obsolete example
ACPI: video: Use native backlight on Dell Inspiron N4010
ACPI: PM: s2idle: Use LPS0 idle if ACPI_FADT_LOW_POWER_S0 is unset
Revert "ACPI / PM: LPIT: Register sysfs attributes based on FADT"
ACPI: video: Shortening quirk list by identifying Clevo by board_name only
ACPI: video: Force backlight native for some TongFang devices
ACPI: PM: s2idle: Add support for upcoming AMD uPEP HID AMDI008
ACPI: VIOT: Fix ACS setup
ACPI: bus: Drop unused list heads from struct acpi_device
hisi_lpc: Use acpi_dev_for_each_child()
bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe()
ACPI: bus: Drop driver member of struct acpi_device
ACPI: bus: Drop redundant check in acpi_device_remove()
ACPI: APEI: Fix _EINJ vs EFI_MEMORY_SP
ACPI: LPSS: Fix missing check in register_device_clock()
ACPI: APEI: Better fix to avoid spamming the console with old error logs
...
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r-- | drivers/acpi/bus.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 0dbb39ef4179..c0d20d997891 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -464,7 +464,6 @@ out_free: static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) { struct acpi_device *adev; - struct acpi_driver *driver; u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; bool hotplug_event = false; @@ -516,10 +515,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) if (!adev) goto err; - driver = adev->driver; - if (driver && driver->ops.notify && - (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) - driver->ops.notify(adev, type); + if (adev->dev.driver) { + struct acpi_driver *driver = to_acpi_driver(adev->dev.driver); + + if (driver && driver->ops.notify && + (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) + driver->ops.notify(adev, type); + } if (!hotplug_event) { acpi_bus_put_acpi_device(adev); @@ -538,8 +540,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) static void acpi_notify_device(acpi_handle handle, u32 event, void *data) { struct acpi_device *device = data; + struct acpi_driver *acpi_drv = to_acpi_driver(device->dev.driver); - device->driver->ops.notify(device, event); + acpi_drv->ops.notify(device, event); } static void acpi_notify_device_fixed(void *data) @@ -1032,8 +1035,6 @@ static int acpi_device_probe(struct device *dev) if (ret) return ret; - acpi_dev->driver = acpi_drv; - pr_debug("Driver [%s] successfully bound to device [%s]\n", acpi_drv->name, acpi_dev->pnp.bus_id); @@ -1043,7 +1044,6 @@ static int acpi_device_probe(struct device *dev) if (acpi_drv->ops.remove) acpi_drv->ops.remove(acpi_dev); - acpi_dev->driver = NULL; acpi_dev->driver_data = NULL; return ret; } @@ -1059,15 +1059,14 @@ static int acpi_device_probe(struct device *dev) static void acpi_device_remove(struct device *dev) { struct acpi_device *acpi_dev = to_acpi_device(dev); - struct acpi_driver *acpi_drv = acpi_dev->driver; + struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); + + if (acpi_drv->ops.notify) + acpi_device_remove_notify_handler(acpi_dev); + + if (acpi_drv->ops.remove) + acpi_drv->ops.remove(acpi_dev); - if (acpi_drv) { - if (acpi_drv->ops.notify) - acpi_device_remove_notify_handler(acpi_dev); - if (acpi_drv->ops.remove) - acpi_drv->ops.remove(acpi_dev); - } - acpi_dev->driver = NULL; acpi_dev->driver_data = NULL; put_device(dev); @@ -1101,6 +1100,7 @@ static int acpi_dev_for_one_check(struct device *dev, void *context) return adwc->fn(to_acpi_device(dev), adwc->data); } +EXPORT_SYMBOL_GPL(acpi_dev_for_each_child); int acpi_dev_for_each_child(struct acpi_device *adev, int (*fn)(struct acpi_device *, void *), void *data) @@ -1113,6 +1113,18 @@ int acpi_dev_for_each_child(struct acpi_device *adev, return device_for_each_child(&adev->dev, &adwc, acpi_dev_for_one_check); } +int acpi_dev_for_each_child_reverse(struct acpi_device *adev, + int (*fn)(struct acpi_device *, void *), + void *data) +{ + struct acpi_dev_walk_context adwc = { + .fn = fn, + .data = data, + }; + + return device_for_each_child_reverse(&adev->dev, &adwc, acpi_dev_for_one_check); +} + /* -------------------------------------------------------------------------- Initialization/Cleanup -------------------------------------------------------------------------- */ @@ -1402,6 +1414,7 @@ static int __init acpi_init(void) pci_mmcfg_late_init(); acpi_iort_init(); + acpi_viot_early_init(); acpi_hest_init(); acpi_ghes_init(); acpi_scan_init(); |