• H
    ACPI: power: Skip duplicate power resource references in _PRx · 7d7b467c
    Hans de Goede 提交于
    Some ACPI tables contain duplicate power resource references like this:
    
            Name (_PR0, Package (0x04)  // _PR0: Power Resources for D0
            {
                P28P,
                P18P,
                P18P,
                CLK4
            })
    
    This causes a WARN_ON in sysfs_add_link_to_group() because we end up
    adding a link to the same acpi_device twice:
    
    sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/808622C1:00/OVTI2680:00/power_resources_D0/LNXPOWER:0a'
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.12-301.fc29.x86_64 #1
    Hardware name: Insyde CherryTrail/Type2 - Board Product Name, BIOS jumperx.T87.KFBNEEA02 04/13/2016
    Call Trace:
     dump_stack+0x5c/0x80
     sysfs_warn_dup.cold.3+0x17/0x2a
     sysfs_do_create_link_sd.isra.2+0xa9/0xb0
     sysfs_add_link_to_group+0x30/0x50
     acpi_power_expose_list+0x74/0xa0
     acpi_power_add_remove_device+0x50/0xa0
     acpi_add_single_object+0x26b/0x5f0
     acpi_bus_check_add+0xc4/0x250
     ...
    
    To address this issue, make acpi_extract_power_resources() check for
    duplicates and simply skip them when found.
    
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: NHans de Goede <hdegoede@redhat.com>
    [ rjw: Subject & changelog, comments ]
    Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    7d7b467c
power.c 23.1 KB