Commit 7342798d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI / hotplug / PCI: Drop sun field from struct acpiphp_slot

If the slot unique number is passed as an additional argument to
acpiphp_register_hotplug_slot(), the 'sun' field in struct
acpiphp_slot is only used by ibm_[s|g]et_attention_status(),
but then it's more efficient to store it in struct slot.

Thus move the 'sun' field from struct acpiphp_slot to struct slot
changing its data type to unsigned int in the process, and redefine
acpiphp_register_hotplug_slot() to take the slot number as separate
argument.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent bbd34fcd
...@@ -60,6 +60,7 @@ struct slot { ...@@ -60,6 +60,7 @@ struct slot {
struct hotplug_slot *hotplug_slot; struct hotplug_slot *hotplug_slot;
struct acpiphp_slot *acpi_slot; struct acpiphp_slot *acpi_slot;
struct hotplug_slot_info info; struct hotplug_slot_info info;
unsigned int sun; /* ACPI _SUN (Slot User Number) value */
}; };
static inline const char *slot_name(struct slot *slot) static inline const char *slot_name(struct slot *slot)
...@@ -106,8 +107,6 @@ struct acpiphp_slot { ...@@ -106,8 +107,6 @@ struct acpiphp_slot {
struct mutex crit_sect; struct mutex crit_sect;
u8 device; /* pci device# */ u8 device; /* pci device# */
unsigned long long sun; /* ACPI _SUN (slot unique number) */
u32 flags; /* see below */ u32 flags; /* see below */
}; };
...@@ -179,7 +178,7 @@ struct acpiphp_attention_info ...@@ -179,7 +178,7 @@ struct acpiphp_attention_info
/* acpiphp_core.c */ /* acpiphp_core.c */
int acpiphp_register_attention(struct acpiphp_attention_info*info); int acpiphp_register_attention(struct acpiphp_attention_info*info);
int acpiphp_unregister_attention(struct acpiphp_attention_info *info); int acpiphp_unregister_attention(struct acpiphp_attention_info *info);
int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot); int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot, unsigned int sun);
void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot); void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
/* acpiphp_glue.c */ /* acpiphp_glue.c */
......
...@@ -290,7 +290,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot) ...@@ -290,7 +290,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
} }
/* callback routine to initialize 'struct slot' for each slot */ /* callback routine to initialize 'struct slot' for each slot */
int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot,
unsigned int sun)
{ {
struct slot *slot; struct slot *slot;
int retval = -ENOMEM; int retval = -ENOMEM;
...@@ -317,7 +318,8 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) ...@@ -317,7 +318,8 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot); slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot);
acpiphp_slot->slot = slot; acpiphp_slot->slot = slot;
snprintf(name, SLOT_NAME_SIZE, "%llu", slot->acpi_slot->sun); slot->sun = sun;
snprintf(name, SLOT_NAME_SIZE, "%u", sun);
retval = pci_hp_register(slot->hotplug_slot, retval = pci_hp_register(slot->hotplug_slot,
acpiphp_slot->bridge->pci_bus, acpiphp_slot->bridge->pci_bus,
......
...@@ -352,16 +352,15 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, ...@@ -352,16 +352,15 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data,
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
sun = bridge->nr_slots; sun = bridge->nr_slots;
slot->sun = sun;
dbg("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n", dbg("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n",
slot->sun, pci_domain_nr(pbus), pbus->number, device); sun, pci_domain_nr(pbus), pbus->number, device);
retval = acpiphp_register_hotplug_slot(slot); retval = acpiphp_register_hotplug_slot(slot, sun);
if (retval) { if (retval) {
bridge->nr_slots--; bridge->nr_slots--;
if (retval == -EBUSY) if (retval == -EBUSY)
warn("Slot %llu already registered by another " warn("Slot %llu already registered by another "
"hotplug driver\n", slot->sun); "hotplug driver\n", sun);
else else
warn("acpiphp_register_hotplug_slot failed " warn("acpiphp_register_hotplug_slot failed "
"(err code = 0x%x)\n", retval); "(err code = 0x%x)\n", retval);
......
...@@ -66,7 +66,7 @@ do { \ ...@@ -66,7 +66,7 @@ do { \
#define IBM_HARDWARE_ID1 "IBM37D0" #define IBM_HARDWARE_ID1 "IBM37D0"
#define IBM_HARDWARE_ID2 "IBM37D4" #define IBM_HARDWARE_ID2 "IBM37D4"
#define hpslot_to_sun(A) (((struct slot *)((A)->private))->acpi_slot->sun) #define hpslot_to_sun(A) (((struct slot *)((A)->private))->sun)
/* union apci_descriptor - allows access to the /* union apci_descriptor - allows access to the
* various device descriptors that are embedded in the * various device descriptors that are embedded in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment