PCI: acpiphp: Keep driver loaded even if no slots found
authorYinghai Lu <yinghai@kernel.org>
Mon, 21 Jan 2013 21:20:50 +0000 (13:20 -0800)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 25 Jan 2013 21:53:48 +0000 (14:53 -0700)
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>
drivers/pci/hotplug/acpiphp.h
drivers/pci/hotplug/acpiphp_core.c
drivers/pci/hotplug/acpiphp_glue.c

index a1afb5b39ad4d03b075a02326796b4e9a8045949..b3ead7ad7b317c46193db59ade8d4d2ab19a6092 100644 (file)
@@ -193,7 +193,6 @@ extern void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
 /* acpiphp_glue.c */
 extern int acpiphp_glue_init (void);
 extern void acpiphp_glue_exit (void);
-extern int acpiphp_get_num_slots (void);
 typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
 
 extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
index 96316b74969f6e7588243e5b36839647319df077..c2fd3095701f5a8bd3f91c56f7b7a8e51913d182 100644 (file)
@@ -50,7 +50,6 @@
 bool acpiphp_debug;
 
 /* local variables */
-static int num_slots;
 static struct acpiphp_attention_info *attention_info;
 
 #define DRIVER_VERSION "0.5"
@@ -272,25 +271,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
        return 0;
 }
 
-static int __init init_acpi(void)
-{
-       int retval;
-
-       /* initialize internal data structure etc. */
-       retval = acpiphp_glue_init();
-
-       /* read initial number of slots */
-       if (!retval) {
-               num_slots = acpiphp_get_num_slots();
-               if (num_slots == 0) {
-                       acpiphp_glue_exit();
-                       retval = -ENODEV;
-               }
-       }
-
-       return retval;
-}
-
 /**
  * release_slot - free up the memory used by a slot
  * @hotplug_slot: slot to free
@@ -379,7 +359,8 @@ static int __init acpiphp_init(void)
                return 0;
 
        /* read all the ACPI info from the system */
-       return init_acpi();
+       /* initialize internal data structure etc. */
+       return acpiphp_glue_init();
 }
 
 
index c4a6301009f2f92472a12fdecb479cae08a4465c..bd784ff4a244fc57dfeaa6ea6c5be704b7c178bc 100644 (file)
@@ -1416,28 +1416,6 @@ void  acpiphp_glue_exit(void)
        acpi_pci_unregister_driver(&acpi_pci_hp_driver);
 }
 
-
-/**
- * acpiphp_get_num_slots - count number of slots in a system
- */
-int __init acpiphp_get_num_slots(void)
-{
-       struct acpiphp_bridge *bridge;
-       int num_slots = 0;
-
-       list_for_each_entry(bridge, &bridge_list, list) {
-               dbg("Bus %04x:%02x has %d slot%s\n",
-                               pci_domain_nr(bridge->pci_bus),
-                               bridge->pci_bus->number, bridge->nr_slots,
-                               bridge->nr_slots == 1 ? "" : "s");
-               num_slots += bridge->nr_slots;
-       }
-
-       dbg("Total %d slots\n", num_slots);
-       return num_slots;
-}
-
-
 /**
  * acpiphp_enable_slot - power on slot
  * @slot: ACPI PHP slot
This page took 0.028572 seconds and 5 git commands to generate.