• Rolf Eike Beer's avatar
    PCI: Change memory allocation for acpiphp slots · ac9e9891
    Rolf Eike Beer authored
    Change memory allocation for acpiphp slots
    
    Change the "struct slot" that acpiphp uses for managing it's slots to
    directly contain the memory for the needed struct hotplug_slot_info and
    the slot's name. This way we need only two memory allocations per slot
    instead of four.
    
    While we are at it: make_slot_name() is just a wrapper around snprintf()
    knowing the right arguments to call it. Since the function makes just one
    function call and is only called from one place I inlined it by hand.
    
    Finally this fixes a possible bug waiting for someone to hit it. There were
    two unused local variables in acpiphp_register_hotplug_slot(). gcc did not
    find them because they were used in memory allocations with sizeof(*var).
    They had the same types as the target of the allocation, but nevertheless
    this was just weird.
    Signed-off-by: default avatarRolf Eike Beer <eike-hotplug@sf-tec.de>
    Acked-by: default avatarMatthew Wilcox <matthew@wil.cx>
    Signed-off-by: default avatarKristen Carlson Accardi <kristen.c.accardi@intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    
    ac9e9891
acpiphp.h 6.29 KB