• Alex Chiang's avatar
    PCI: pciehp: Rename duplicate slot name N as N-1, N-2, N-M... · 167e782e
    Alex Chiang authored
    Commit 3800345f (pciehp: fix slot name)
    introduces the pciehp_slot_with_bus module parameter, which was intended
    to help work around broken firmware that assigns the same name to multiple
    slots.
    
    Commit 9e4f2e8d (pciehp: add message about
    pciehp_slot_with_bus option) tells the user to use the above parameter
    in the event of a name collision.
    
    This approach is sub-optimal because it requires too much work from
    the user.
    
    Instead, let's rename the slot on behalf of the user. If firmware
    assigns the name N to multiple slots, then:
    
    	The first registered slot is assigned N
    	The second registered slot is assigned N-1
    	The third registered slot is assigned N-2
    	The Mth registered slot becomes N-M
    
    In the event we overflow the slot->name parameter, we report an
    error to the user.
    
    This is a temporary fix until the entire PCI core can be reworked
    such that individual drivers no longer have to manage their own
    slot names.
    Tested-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
    Acked-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
    Signed-off-by: default avatarAlex Chiang <achiang@hp.com>
    Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
    167e782e
pciehp_core.c 13.9 KB