Commit d59f53bc9bd80ee62072dea590fc623c67cb84a8

Authored by Yinghai Lu
Committed by Bjorn Helgaas
1 parent 121b090e7d

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>

Showing 3 changed files with 2 additions and 44 deletions Side-by-side Diff

drivers/pci/hotplug/acpiphp.h
... ... @@ -193,7 +193,6 @@
193 193 /* acpiphp_glue.c */
194 194 extern int acpiphp_glue_init (void);
195 195 extern void acpiphp_glue_exit (void);
196   -extern int acpiphp_get_num_slots (void);
197 196 typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
198 197  
199 198 extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
drivers/pci/hotplug/acpiphp_core.c
... ... @@ -50,7 +50,6 @@
50 50 bool acpiphp_debug;
51 51  
52 52 /* local variables */
53   -static int num_slots;
54 53 static struct acpiphp_attention_info *attention_info;
55 54  
56 55 #define DRIVER_VERSION "0.5"
... ... @@ -272,25 +271,6 @@
272 271 return 0;
273 272 }
274 273  
275   -static 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 275 * release_slot - free up the memory used by a slot
296 276 * @hotplug_slot: slot to free
... ... @@ -379,7 +359,8 @@
379 359 return 0;
380 360  
381 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  
drivers/pci/hotplug/acpiphp_glue.c
... ... @@ -1416,28 +1416,6 @@
1416 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   - */
1423   -int __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 1420 * acpiphp_enable_slot - power on slot
1443 1421 * @slot: ACPI PHP slot