Skip to content

Commit d59f53b

Browse files
Yinghai Lubjorn-helgaas
authored andcommitted
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>
1 parent 121b090 commit d59f53b

File tree

3 files changed

+2
-44
lines changed

3 files changed

+2
-44
lines changed

drivers/pci/hotplug/acpiphp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ extern void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
193193
/* acpiphp_glue.c */
194194
extern int acpiphp_glue_init (void);
195195
extern void acpiphp_glue_exit (void);
196-
extern int acpiphp_get_num_slots (void);
197196
typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
198197

199198
extern int acpiphp_enable_slot (struct acpiphp_slot *slot);

drivers/pci/hotplug/acpiphp_core.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
bool acpiphp_debug;
5151

5252
/* local variables */
53-
static int num_slots;
5453
static struct acpiphp_attention_info *attention_info;
5554

5655
#define DRIVER_VERSION "0.5"
@@ -272,25 +271,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
272271
return 0;
273272
}
274273

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-
294274
/**
295275
* release_slot - free up the memory used by a slot
296276
* @hotplug_slot: slot to free
@@ -379,7 +359,8 @@ static int __init acpiphp_init(void)
379359
return 0;
380360

381361
/* read all the ACPI info from the system */
382-
return init_acpi();
362+
/* initialize internal data structure etc. */
363+
return acpiphp_glue_init();
383364
}
384365

385366

drivers/pci/hotplug/acpiphp_glue.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,28 +1416,6 @@ void acpiphp_glue_exit(void)
14161416
acpi_pci_unregister_driver(&acpi_pci_hp_driver);
14171417
}
14181418

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-
14411419
/**
14421420
* acpiphp_enable_slot - power on slot
14431421
* @slot: ACPI PHP slot

0 commit comments

Comments
 (0)