diff options
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_slot.c')
-rw-r--r-- | drivers/pci/hotplug/rpaphp_slot.c | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 56197b600d36..9b714ea93d20 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c | |||
@@ -33,33 +33,6 @@ | |||
33 | #include <asm/rtas.h> | 33 | #include <asm/rtas.h> |
34 | #include "rpaphp.h" | 34 | #include "rpaphp.h" |
35 | 35 | ||
36 | static ssize_t address_read_file (struct hotplug_slot *php_slot, char *buf) | ||
37 | { | ||
38 | int retval; | ||
39 | struct slot *slot = (struct slot *)php_slot->private; | ||
40 | struct pci_bus *bus; | ||
41 | |||
42 | if (!slot) | ||
43 | return -ENOENT; | ||
44 | |||
45 | bus = slot->bus; | ||
46 | if (!bus) | ||
47 | return -ENOENT; | ||
48 | |||
49 | if (bus->self) | ||
50 | retval = sprintf(buf, pci_name(bus->self)); | ||
51 | else | ||
52 | retval = sprintf(buf, "%04x:%02x:00.0", | ||
53 | pci_domain_nr(bus), bus->number); | ||
54 | |||
55 | return retval; | ||
56 | } | ||
57 | |||
58 | static struct hotplug_slot_attribute php_attr_address = { | ||
59 | .attr = {.name = "address", .mode = S_IFREG | S_IRUGO}, | ||
60 | .show = address_read_file, | ||
61 | }; | ||
62 | |||
63 | /* free up the memory used by a slot */ | 36 | /* free up the memory used by a slot */ |
64 | static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) | 37 | static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) |
65 | { | 38 | { |
@@ -135,9 +108,6 @@ int rpaphp_deregister_slot(struct slot *slot) | |||
135 | 108 | ||
136 | list_del(&slot->rpaphp_slot_list); | 109 | list_del(&slot->rpaphp_slot_list); |
137 | 110 | ||
138 | /* remove "address" file */ | ||
139 | sysfs_remove_file(&php_slot->kobj, &php_attr_address.attr); | ||
140 | |||
141 | retval = pci_hp_deregister(php_slot); | 111 | retval = pci_hp_deregister(php_slot); |
142 | if (retval) | 112 | if (retval) |
143 | err("Problem unregistering a slot %s\n", slot->name); | 113 | err("Problem unregistering a slot %s\n", slot->name); |
@@ -151,6 +121,7 @@ int rpaphp_register_slot(struct slot *slot) | |||
151 | { | 121 | { |
152 | struct hotplug_slot *php_slot = slot->hotplug_slot; | 122 | struct hotplug_slot *php_slot = slot->hotplug_slot; |
153 | int retval; | 123 | int retval; |
124 | int slotno; | ||
154 | 125 | ||
155 | dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", | 126 | dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", |
156 | __func__, slot->dn->full_name, slot->index, slot->name, | 127 | __func__, slot->dn->full_name, slot->index, slot->name, |
@@ -162,19 +133,16 @@ int rpaphp_register_slot(struct slot *slot) | |||
162 | return -EAGAIN; | 133 | return -EAGAIN; |
163 | } | 134 | } |
164 | 135 | ||
165 | retval = pci_hp_register(php_slot); | 136 | if (slot->dn->child) |
137 | slotno = PCI_SLOT(PCI_DN(slot->dn->child)->devfn); | ||
138 | else | ||
139 | slotno = -1; | ||
140 | retval = pci_hp_register(php_slot, slot->bus, slotno); | ||
166 | if (retval) { | 141 | if (retval) { |
167 | err("pci_hp_register failed with error %d\n", retval); | 142 | err("pci_hp_register failed with error %d\n", retval); |
168 | return retval; | 143 | return retval; |
169 | } | 144 | } |
170 | 145 | ||
171 | /* create "address" file */ | ||
172 | retval = sysfs_create_file(&php_slot->kobj, &php_attr_address.attr); | ||
173 | if (retval) { | ||
174 | err("sysfs_create_file failed with error %d\n", retval); | ||
175 | goto sysfs_fail; | ||
176 | } | ||
177 | |||
178 | /* add slot to our internal list */ | 146 | /* add slot to our internal list */ |
179 | list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); | 147 | list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); |
180 | info("Slot [%s] registered\n", slot->name); | 148 | info("Slot [%s] registered\n", slot->name); |