• L
    PCI: Autosense device removal in pci_bridge_d3_update() · 1ed276a7
    Lukas Wunner 提交于
    The algorithm to update the flag indicating whether a bridge may go to D3
    makes a few optimizations based on whether the update was caused by the
    removal of a device on the one hand, versus the addition of a device or the
    change of its D3cold flags on the other hand.
    
    The information whether the update pertains to a removal is currently
    passed in by the caller, but the function may as well determine that itself
    by examining the device in question, thereby allowing for a considerable
    simplification and reduction of the code.
    
    Out of several options to determine removal, I've chosen the function
    device_is_registered() because it's cheap:  It merely returns the
    dev->kobj.state_in_sysfs flag.  That flag is set through device_add() when
    the root bus is scanned and cleared through device_remove().  The call to
    pci_bridge_d3_update() happens after each of these calls, respectively, so
    the ordering is correct.
    
    No functional change intended.
    Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: NLukas Wunner <lukas@wunner.de>
    Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    1ed276a7
pci.c 137.1 KB