• Rafael J. Wysocki's avatar
    ACPI: scan: Rearrange dep_unmet initialization · 6d279758
    Rafael J. Wysocki authored
    The dep_unmet field in struct acpi_device is used to store the
    number of unresolved _DEP dependencies (that is, operation region
    dependencies for which there are no drivers present) for the ACPI
    device object represented by it.
    
    That field is initialized to 1 for all ACPI device objects in
    acpi_add_single_object(), via acpi_init_device_object(), so as to
    avoid evaluating _STA prematurely for battery device objects in
    acpi_scan_init_status(), and it is "fixed up" in acpi_bus_check_add()
    after the acpi_add_single_object() called by it has returned.
    
    This is not particularly straightforward and causes dep_unmet to
    remain 1 for device objects without dependencies created by invoking
    acpi_add_single_object() directly, outside acpi_bus_check_add().
    
    For this reason, rearrange acpi_add_single_object() to initialize
    dep_unmet completely before calling acpi_scan_init_status(), which
    requires passing one extra bool argument to it, and update all of
    its callers accordingly.
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    6d279758
scan.c 61.1 KB