aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index ff32c6b4ae13..844580489d4d 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -424,6 +424,9 @@ static int fs_add_slot(struct pci_slot *slot)
424{ 424{
425 int retval = 0; 425 int retval = 0;
426 426
427 /* Create symbolic link to the hotplug driver module */
428 pci_hp_create_module_link(slot);
429
427 if (has_power_file(slot)) { 430 if (has_power_file(slot)) {
428 retval = sysfs_create_file(&slot->kobj, 431 retval = sysfs_create_file(&slot->kobj,
429 &hotplug_slot_attr_power.attr); 432 &hotplug_slot_attr_power.attr);
@@ -498,6 +501,7 @@ exit_attention:
498 if (has_power_file(slot)) 501 if (has_power_file(slot))
499 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr); 502 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr);
500exit_power: 503exit_power:
504 pci_hp_remove_module_link(slot);
501exit: 505exit:
502 return retval; 506 return retval;
503} 507}
@@ -528,6 +532,8 @@ static void fs_remove_slot(struct pci_slot *slot)
528 532
529 if (has_test_file(slot)) 533 if (has_test_file(slot))
530 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr); 534 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr);
535
536 pci_hp_remove_module_link(slot);
531} 537}
532 538
533static struct hotplug_slot *get_slot_from_name (const char *name) 539static struct hotplug_slot *get_slot_from_name (const char *name)
@@ -544,10 +550,10 @@ static struct hotplug_slot *get_slot_from_name (const char *name)
544} 550}
545 551
546/** 552/**
547 * pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem 553 * __pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem
548 * @bus: bus this slot is on 554 * @bus: bus this slot is on
549 * @slot: pointer to the &struct hotplug_slot to register 555 * @slot: pointer to the &struct hotplug_slot to register
550 * @slot_nr: slot number 556 * @devnr: device number
551 * @name: name registered with kobject core 557 * @name: name registered with kobject core
552 * 558 *
553 * Registers a hotplug slot with the pci hotplug subsystem, which will allow 559 * Registers a hotplug slot with the pci hotplug subsystem, which will allow
@@ -555,8 +561,9 @@ static struct hotplug_slot *get_slot_from_name (const char *name)
555 * 561 *
556 * Returns 0 if successful, anything else for an error. 562 * Returns 0 if successful, anything else for an error.
557 */ 563 */
558int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr, 564int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus,
559 const char *name) 565 int devnr, const char *name,
566 struct module *owner, const char *mod_name)
560{ 567{
561 int result; 568 int result;
562 struct pci_slot *pci_slot; 569 struct pci_slot *pci_slot;
@@ -571,14 +578,16 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr,
571 return -EINVAL; 578 return -EINVAL;
572 } 579 }
573 580
574 mutex_lock(&pci_hp_mutex); 581 slot->ops->owner = owner;
582 slot->ops->mod_name = mod_name;
575 583
584 mutex_lock(&pci_hp_mutex);
576 /* 585 /*
577 * No problems if we call this interface from both ACPI_PCI_SLOT 586 * No problems if we call this interface from both ACPI_PCI_SLOT
578 * driver and call it here again. If we've already created the 587 * driver and call it here again. If we've already created the
579 * pci_slot, the interface will simply bump the refcount. 588 * pci_slot, the interface will simply bump the refcount.
580 */ 589 */
581 pci_slot = pci_create_slot(bus, slot_nr, name, slot); 590 pci_slot = pci_create_slot(bus, devnr, name, slot);
582 if (IS_ERR(pci_slot)) { 591 if (IS_ERR(pci_slot)) {
583 result = PTR_ERR(pci_slot); 592 result = PTR_ERR(pci_slot);
584 goto out; 593 goto out;
@@ -688,6 +697,6 @@ MODULE_LICENSE("GPL");
688module_param(debug, bool, 0644); 697module_param(debug, bool, 0644);
689MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); 698MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
690 699
691EXPORT_SYMBOL_GPL(pci_hp_register); 700EXPORT_SYMBOL_GPL(__pci_hp_register);
692EXPORT_SYMBOL_GPL(pci_hp_deregister); 701EXPORT_SYMBOL_GPL(pci_hp_deregister);
693EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); 702EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);