aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2008-10-20 19:40:42 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-22 19:42:37 -0400
commit1359f2701b96abd9bb69c1273fb995a093b6409a (patch)
treeee82a6db101926041d7a357e0f474eb8c39557c4 /drivers/pci
parent48ff96ce0774f7634a9497c3589d49bf9d64e0ba (diff)
PCI Hotplug core: add 'name' param pci_hp_register interface
Update pci_hp_register() to take a const char *name parameter. The motivation for this is to clean up the individual hotplug drivers so that each one does not have to manage its own name. The PCI core should be the place where we manage the name. We update the interface and all callsites first, in a "no functional change" manner, and clean up the drivers later. Cc: kristen.c.accardi@intel.com Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Reviewed-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c3
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c3
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c3
-rw-r--r--drivers/pci/hotplug/fakephp.c3
-rw-r--r--drivers/pci/hotplug/ibmphp_ebda.c3
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c15
-rw-r--r--drivers/pci/hotplug/pciehp_core.c3
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c2
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c3
-rw-r--r--drivers/pci/hotplug/shpchp_core.c3
10 files changed, 25 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index 0e496e866a84..e9841765339f 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -340,7 +340,8 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
340 340
341 retval = pci_hp_register(slot->hotplug_slot, 341 retval = pci_hp_register(slot->hotplug_slot,
342 acpiphp_slot->bridge->pci_bus, 342 acpiphp_slot->bridge->pci_bus,
343 acpiphp_slot->device); 343 acpiphp_slot->device,
344 slot->name);
344 if (retval == -EBUSY) 345 if (retval == -EBUSY)
345 goto error_hpslot; 346 goto error_hpslot;
346 if (retval) { 347 if (retval) {
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 935947991dc9..5e5dee85763c 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -285,7 +285,8 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
285 info->attention_status = cpci_get_attention_status(slot); 285 info->attention_status = cpci_get_attention_status(slot);
286 286
287 dbg("registering slot %s", slot->hotplug_slot->name); 287 dbg("registering slot %s", slot->hotplug_slot->name);
288 status = pci_hp_register(slot->hotplug_slot, bus, i); 288 status = pci_hp_register(slot->hotplug_slot, bus, i,
289 slot->hotplug_slot->name);
289 if (status) { 290 if (status) {
290 err("pci_hp_register failed with error %d", status); 291 err("pci_hp_register failed with error %d", status);
291 goto error_name; 292 goto error_name;
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index 54defec51d08..a7fe4584f00b 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -436,7 +436,8 @@ static int ctrl_slot_setup(struct controller *ctrl,
436 slot_number); 436 slot_number);
437 result = pci_hp_register(hotplug_slot, 437 result = pci_hp_register(hotplug_slot,
438 ctrl->pci_dev->subordinate, 438 ctrl->pci_dev->subordinate,
439 slot->device); 439 slot->device,
440 hotplug_slot->name);
440 if (result) { 441 if (result) {
441 err("pci_hp_register failed with error %d\n", result); 442 err("pci_hp_register failed with error %d\n", result);
442 goto error_name; 443 goto error_name;
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 146ca9cd1567..3069f2153832 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -126,7 +126,8 @@ static int add_slot(struct pci_dev *dev)
126 slot->release = &dummy_release; 126 slot->release = &dummy_release;
127 slot->private = dslot; 127 slot->private = dslot;
128 128
129 retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn)); 129 retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn),
130 slot->name);
130 if (retval) { 131 if (retval) {
131 err("pci_hp_register failed with error %d\n", retval); 132 err("pci_hp_register failed with error %d\n", retval);
132 goto error_dslot; 133 goto error_dslot;
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index 8cfd1c4926c8..342d3e8f77c8 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -966,7 +966,8 @@ static int __init ebda_rsrc_controller (void)
966 list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) { 966 list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) {
967 snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot)); 967 snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot));
968 pci_hp_register(tmp_slot->hotplug_slot, 968 pci_hp_register(tmp_slot->hotplug_slot,
969 pci_find_bus(0, tmp_slot->bus), tmp_slot->device); 969 pci_find_bus(0, tmp_slot->bus), tmp_slot->device,
970 tmp_slot->hotplug_slot->name);
970 } 971 }
971 972
972 print_ebda_hpc (); 973 print_ebda_hpc ();
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index 2e6c4474644e..02b1ae12a2e6 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -547,13 +547,15 @@ out:
547 * @bus: bus this slot is on 547 * @bus: bus this slot is on
548 * @slot: pointer to the &struct hotplug_slot to register 548 * @slot: pointer to the &struct hotplug_slot to register
549 * @slot_nr: slot number 549 * @slot_nr: slot number
550 * @name: name registered with kobject core
550 * 551 *
551 * Registers a hotplug slot with the pci hotplug subsystem, which will allow 552 * Registers a hotplug slot with the pci hotplug subsystem, which will allow
552 * userspace interaction to the slot. 553 * userspace interaction to the slot.
553 * 554 *
554 * Returns 0 if successful, anything else for an error. 555 * Returns 0 if successful, anything else for an error.
555 */ 556 */
556int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr) 557int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr,
558 const char *name)
557{ 559{
558 int result; 560 int result;
559 struct pci_slot *pci_slot; 561 struct pci_slot *pci_slot;
@@ -569,7 +571,7 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
569 } 571 }
570 572
571 /* Check if we have already registered a slot with the same name. */ 573 /* Check if we have already registered a slot with the same name. */
572 if (get_slot_from_name(slot->name)) 574 if (get_slot_from_name(name))
573 return -EEXIST; 575 return -EEXIST;
574 576
575 /* 577 /*
@@ -577,7 +579,7 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
577 * driver and call it here again. If we've already created the 579 * driver and call it here again. If we've already created the
578 * pci_slot, the interface will simply bump the refcount. 580 * pci_slot, the interface will simply bump the refcount.
579 */ 581 */
580 pci_slot = pci_create_slot(bus, slot_nr, slot->name); 582 pci_slot = pci_create_slot(bus, slot_nr, name);
581 if (IS_ERR(pci_slot)) 583 if (IS_ERR(pci_slot))
582 return PTR_ERR(pci_slot); 584 return PTR_ERR(pci_slot);
583 585
@@ -593,8 +595,8 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
593 /* 595 /*
594 * Allow pcihp drivers to override the ACPI_PCI_SLOT name. 596 * Allow pcihp drivers to override the ACPI_PCI_SLOT name.
595 */ 597 */
596 if (strcmp(kobject_name(&pci_slot->kobj), slot->name)) { 598 if (strcmp(kobject_name(&pci_slot->kobj), name)) {
597 result = kobject_rename(&pci_slot->kobj, slot->name); 599 result = kobject_rename(&pci_slot->kobj, name);
598 if (result) { 600 if (result) {
599 pci_destroy_slot(pci_slot); 601 pci_destroy_slot(pci_slot);
600 return result; 602 return result;
@@ -607,8 +609,7 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
607 609
608 result = fs_add_slot(pci_slot); 610 result = fs_add_slot(pci_slot);
609 kobject_uevent(&pci_slot->kobj, KOBJ_ADD); 611 kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
610 dbg("Added slot %s to the list\n", slot->name); 612 dbg("Added slot %s to the list\n", name);
611
612 613
613 return result; 614 return result;
614} 615}
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index c748a19db89d..3ace5e057601 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -226,7 +226,8 @@ static int init_slots(struct controller *ctrl)
226duplicate_name: 226duplicate_name:
227 retval = pci_hp_register(hotplug_slot, 227 retval = pci_hp_register(hotplug_slot,
228 ctrl->pci_dev->subordinate, 228 ctrl->pci_dev->subordinate,
229 slot->device); 229 slot->device,
230 slot->name);
230 if (retval) { 231 if (retval) {
231 /* 232 /*
232 * If slot N already exists, we'll try to create 233 * If slot N already exists, we'll try to create
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 50884507b8be..736d3b43ed0b 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -137,7 +137,7 @@ int rpaphp_register_slot(struct slot *slot)
137 slotno = PCI_SLOT(PCI_DN(slot->dn->child)->devfn); 137 slotno = PCI_SLOT(PCI_DN(slot->dn->child)->devfn);
138 else 138 else
139 slotno = -1; 139 slotno = -1;
140 retval = pci_hp_register(php_slot, slot->bus, slotno); 140 retval = pci_hp_register(php_slot, slot->bus, slotno, slot->name);
141 if (retval) { 141 if (retval) {
142 err("pci_hp_register failed with error %d\n", retval); 142 err("pci_hp_register failed with error %d\n", retval);
143 return retval; 143 return retval;
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index 410fe0394a8e..6d20bbd4359a 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -653,7 +653,8 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
653 bss_hotplug_slot->ops = &sn_hotplug_slot_ops; 653 bss_hotplug_slot->ops = &sn_hotplug_slot_ops;
654 bss_hotplug_slot->release = &sn_release_slot; 654 bss_hotplug_slot->release = &sn_release_slot;
655 655
656 rc = pci_hp_register(bss_hotplug_slot, pci_bus, device); 656 rc = pci_hp_register(bss_hotplug_slot, pci_bus, device,
657 bss_hotplug_slot->name);
657 if (rc) 658 if (rc)
658 goto register_err; 659 goto register_err;
659 660
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index cc38615395f1..bf5096612aab 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -146,7 +146,8 @@ static int init_slots(struct controller *ctrl)
146 slot->hp_slot, slot->number, ctrl->slot_device_offset); 146 slot->hp_slot, slot->number, ctrl->slot_device_offset);
147duplicate_name: 147duplicate_name:
148 retval = pci_hp_register(slot->hotplug_slot, 148 retval = pci_hp_register(slot->hotplug_slot,
149 ctrl->pci_dev->subordinate, slot->device); 149 ctrl->pci_dev->subordinate, slot->device,
150 hotplug_slot->name);
150 if (retval) { 151 if (retval) {
151 /* 152 /*
152 * If slot N already exists, we'll try to create 153 * If slot N already exists, we'll try to create