diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-13 17:27:25 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-22 22:00:22 -0400 |
commit | 7342798d0ab850a630877a362bc5a4f033100f37 (patch) | |
tree | e26c9ce3fabddb86b440a0b5ccf1edb0905a8017 | |
parent | bbd34fcdd1b201e996235731a7c98fd5197d9e51 (diff) |
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 5 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_core.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 7 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_ibm.c | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 76a1c979a251..4f10aec81b82 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -60,6 +60,7 @@ struct slot { | |||
60 | struct hotplug_slot *hotplug_slot; | 60 | struct hotplug_slot *hotplug_slot; |
61 | struct acpiphp_slot *acpi_slot; | 61 | struct acpiphp_slot *acpi_slot; |
62 | struct hotplug_slot_info info; | 62 | struct hotplug_slot_info info; |
63 | unsigned int sun; /* ACPI _SUN (Slot User Number) value */ | ||
63 | }; | 64 | }; |
64 | 65 | ||
65 | static inline const char *slot_name(struct slot *slot) | 66 | static inline const char *slot_name(struct slot *slot) |
@@ -106,8 +107,6 @@ struct acpiphp_slot { | |||
106 | struct mutex crit_sect; | 107 | struct mutex crit_sect; |
107 | 108 | ||
108 | u8 device; /* pci device# */ | 109 | u8 device; /* pci device# */ |
109 | |||
110 | unsigned long long sun; /* ACPI _SUN (slot unique number) */ | ||
111 | u32 flags; /* see below */ | 110 | u32 flags; /* see below */ |
112 | }; | 111 | }; |
113 | 112 | ||
@@ -179,7 +178,7 @@ struct acpiphp_attention_info | |||
179 | /* acpiphp_core.c */ | 178 | /* acpiphp_core.c */ |
180 | int acpiphp_register_attention(struct acpiphp_attention_info*info); | 179 | int acpiphp_register_attention(struct acpiphp_attention_info*info); |
181 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info); | 180 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info); |
182 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot); | 181 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot, unsigned int sun); |
183 | void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot); | 182 | void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot); |
184 | 183 | ||
185 | /* acpiphp_glue.c */ | 184 | /* acpiphp_glue.c */ |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index ca8127950fcd..1798740f7e18 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -290,7 +290,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | /* callback routine to initialize 'struct slot' for each slot */ | 292 | /* callback routine to initialize 'struct slot' for each slot */ |
293 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | 293 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot, |
294 | unsigned int sun) | ||
294 | { | 295 | { |
295 | struct slot *slot; | 296 | struct slot *slot; |
296 | int retval = -ENOMEM; | 297 | int retval = -ENOMEM; |
@@ -317,7 +318,8 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
317 | slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot); | 318 | slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot); |
318 | 319 | ||
319 | acpiphp_slot->slot = slot; | 320 | acpiphp_slot->slot = slot; |
320 | snprintf(name, SLOT_NAME_SIZE, "%llu", slot->acpi_slot->sun); | 321 | slot->sun = sun; |
322 | snprintf(name, SLOT_NAME_SIZE, "%u", sun); | ||
321 | 323 | ||
322 | retval = pci_hp_register(slot->hotplug_slot, | 324 | retval = pci_hp_register(slot->hotplug_slot, |
323 | acpiphp_slot->bridge->pci_bus, | 325 | acpiphp_slot->bridge->pci_bus, |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index b306e993ad08..a251071b7d79 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -352,16 +352,15 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
352 | if (ACPI_FAILURE(status)) | 352 | if (ACPI_FAILURE(status)) |
353 | sun = bridge->nr_slots; | 353 | sun = bridge->nr_slots; |
354 | 354 | ||
355 | slot->sun = sun; | ||
356 | dbg("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n", | 355 | dbg("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n", |
357 | slot->sun, pci_domain_nr(pbus), pbus->number, device); | 356 | sun, pci_domain_nr(pbus), pbus->number, device); |
358 | 357 | ||
359 | retval = acpiphp_register_hotplug_slot(slot); | 358 | retval = acpiphp_register_hotplug_slot(slot, sun); |
360 | if (retval) { | 359 | if (retval) { |
361 | bridge->nr_slots--; | 360 | bridge->nr_slots--; |
362 | if (retval == -EBUSY) | 361 | if (retval == -EBUSY) |
363 | warn("Slot %llu already registered by another " | 362 | warn("Slot %llu already registered by another " |
364 | "hotplug driver\n", slot->sun); | 363 | "hotplug driver\n", sun); |
365 | else | 364 | else |
366 | warn("acpiphp_register_hotplug_slot failed " | 365 | warn("acpiphp_register_hotplug_slot failed " |
367 | "(err code = 0x%x)\n", retval); | 366 | "(err code = 0x%x)\n", retval); |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index c35e8ad6db01..8d45f6d69540 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -66,7 +66,7 @@ do { \ | |||
66 | #define IBM_HARDWARE_ID1 "IBM37D0" | 66 | #define IBM_HARDWARE_ID1 "IBM37D0" |
67 | #define IBM_HARDWARE_ID2 "IBM37D4" | 67 | #define IBM_HARDWARE_ID2 "IBM37D4" |
68 | 68 | ||
69 | #define hpslot_to_sun(A) (((struct slot *)((A)->private))->acpi_slot->sun) | 69 | #define hpslot_to_sun(A) (((struct slot *)((A)->private))->sun) |
70 | 70 | ||
71 | /* union apci_descriptor - allows access to the | 71 | /* union apci_descriptor - allows access to the |
72 | * various device descriptors that are embedded in the | 72 | * various device descriptors that are embedded in the |