aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2013-01-21 16:20:50 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-01-25 16:53:48 -0500
commitd59f53bc9bd80ee62072dea590fc623c67cb84a8 (patch)
treea3a0cc477ebee058882365048690fba057dea014 /drivers/pci/hotplug
parent121b090e7d4063b65f40c267ef0fb34fb278dfdf (diff)
PCI: acpiphp: Keep driver loaded even if no slots found
Could have root bus hot-added later and there may be slots that need acpiphp. The result returned by acpiphp_get_num_slots() is meaningless, because the bridge the slots are under may be added after this function has been called, so drop acpiphp_get_num_slots() and the code using it. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/acpiphp.h1
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c23
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c22
3 files changed, 2 insertions, 44 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index a1afb5b39ad4..b3ead7ad7b31 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -193,7 +193,6 @@ extern void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
193/* acpiphp_glue.c */ 193/* acpiphp_glue.c */
194extern int acpiphp_glue_init (void); 194extern int acpiphp_glue_init (void);
195extern void acpiphp_glue_exit (void); 195extern void acpiphp_glue_exit (void);
196extern int acpiphp_get_num_slots (void);
197typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data); 196typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
198 197
199extern int acpiphp_enable_slot (struct acpiphp_slot *slot); 198extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index 96316b74969f..c2fd3095701f 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -50,7 +50,6 @@
50bool acpiphp_debug; 50bool acpiphp_debug;
51 51
52/* local variables */ 52/* local variables */
53static int num_slots;
54static struct acpiphp_attention_info *attention_info; 53static struct acpiphp_attention_info *attention_info;
55 54
56#define DRIVER_VERSION "0.5" 55#define DRIVER_VERSION "0.5"
@@ -272,25 +271,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
272 return 0; 271 return 0;
273} 272}
274 273
275static int __init init_acpi(void)
276{
277 int retval;
278
279 /* initialize internal data structure etc. */
280 retval = acpiphp_glue_init();
281
282 /* read initial number of slots */
283 if (!retval) {
284 num_slots = acpiphp_get_num_slots();
285 if (num_slots == 0) {
286 acpiphp_glue_exit();
287 retval = -ENODEV;
288 }
289 }
290
291 return retval;
292}
293
294/** 274/**
295 * release_slot - free up the memory used by a slot 275 * release_slot - free up the memory used by a slot
296 * @hotplug_slot: slot to free 276 * @hotplug_slot: slot to free
@@ -379,7 +359,8 @@ static int __init acpiphp_init(void)
379 return 0; 359 return 0;
380 360
381 /* read all the ACPI info from the system */ 361 /* read all the ACPI info from the system */
382 return init_acpi(); 362 /* initialize internal data structure etc. */
363 return acpiphp_glue_init();
383} 364}
384 365
385 366
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index c4a6301009f2..bd784ff4a244 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1416,28 +1416,6 @@ void acpiphp_glue_exit(void)
1416 acpi_pci_unregister_driver(&acpi_pci_hp_driver); 1416 acpi_pci_unregister_driver(&acpi_pci_hp_driver);
1417} 1417}
1418 1418
1419
1420/**
1421 * acpiphp_get_num_slots - count number of slots in a system
1422 */
1423int __init acpiphp_get_num_slots(void)
1424{
1425 struct acpiphp_bridge *bridge;
1426 int num_slots = 0;
1427
1428 list_for_each_entry(bridge, &bridge_list, list) {
1429 dbg("Bus %04x:%02x has %d slot%s\n",
1430 pci_domain_nr(bridge->pci_bus),
1431 bridge->pci_bus->number, bridge->nr_slots,
1432 bridge->nr_slots == 1 ? "" : "s");
1433 num_slots += bridge->nr_slots;
1434 }
1435
1436 dbg("Total %d slots\n", num_slots);
1437 return num_slots;
1438}
1439
1440
1441/** 1419/**
1442 * acpiphp_enable_slot - power on slot 1420 * acpiphp_enable_slot - power on slot
1443 * @slot: ACPI PHP slot 1421 * @slot: ACPI PHP slot