diff options
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_core.c')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_core.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index 0e496e866a84..95b536a23d25 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | #define MY_NAME "acpiphp" | 45 | #define MY_NAME "acpiphp" |
46 | 46 | ||
47 | /* name size which is used for entries in pcihpfs */ | ||
48 | #define SLOT_NAME_SIZE 21 /* {_SUN} */ | ||
49 | |||
47 | static int debug; | 50 | static int debug; |
48 | int acpiphp_debug; | 51 | int acpiphp_debug; |
49 | 52 | ||
@@ -84,7 +87,6 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = { | |||
84 | .get_adapter_status = get_adapter_status, | 87 | .get_adapter_status = get_adapter_status, |
85 | }; | 88 | }; |
86 | 89 | ||
87 | |||
88 | /** | 90 | /** |
89 | * acpiphp_register_attention - set attention LED callback | 91 | * acpiphp_register_attention - set attention LED callback |
90 | * @info: must be completely filled with LED callbacks | 92 | * @info: must be completely filled with LED callbacks |
@@ -136,7 +138,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
136 | { | 138 | { |
137 | struct slot *slot = hotplug_slot->private; | 139 | struct slot *slot = hotplug_slot->private; |
138 | 140 | ||
139 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 141 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
140 | 142 | ||
141 | /* enable the specified slot */ | 143 | /* enable the specified slot */ |
142 | return acpiphp_enable_slot(slot->acpi_slot); | 144 | return acpiphp_enable_slot(slot->acpi_slot); |
@@ -154,7 +156,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
154 | struct slot *slot = hotplug_slot->private; | 156 | struct slot *slot = hotplug_slot->private; |
155 | int retval; | 157 | int retval; |
156 | 158 | ||
157 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 159 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
158 | 160 | ||
159 | /* disable the specified slot */ | 161 | /* disable the specified slot */ |
160 | retval = acpiphp_disable_slot(slot->acpi_slot); | 162 | retval = acpiphp_disable_slot(slot->acpi_slot); |
@@ -177,7 +179,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
177 | { | 179 | { |
178 | int retval = -ENODEV; | 180 | int retval = -ENODEV; |
179 | 181 | ||
180 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 182 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot)); |
181 | 183 | ||
182 | if (attention_info && try_module_get(attention_info->owner)) { | 184 | if (attention_info && try_module_get(attention_info->owner)) { |
183 | retval = attention_info->set_attn(hotplug_slot, status); | 185 | retval = attention_info->set_attn(hotplug_slot, status); |
@@ -200,7 +202,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
200 | { | 202 | { |
201 | struct slot *slot = hotplug_slot->private; | 203 | struct slot *slot = hotplug_slot->private; |
202 | 204 | ||
203 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 205 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
204 | 206 | ||
205 | *value = acpiphp_get_power_status(slot->acpi_slot); | 207 | *value = acpiphp_get_power_status(slot->acpi_slot); |
206 | 208 | ||
@@ -222,7 +224,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
222 | { | 224 | { |
223 | int retval = -EINVAL; | 225 | int retval = -EINVAL; |
224 | 226 | ||
225 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 227 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot)); |
226 | 228 | ||
227 | if (attention_info && try_module_get(attention_info->owner)) { | 229 | if (attention_info && try_module_get(attention_info->owner)) { |
228 | retval = attention_info->get_attn(hotplug_slot, value); | 230 | retval = attention_info->get_attn(hotplug_slot, value); |
@@ -245,7 +247,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
245 | { | 247 | { |
246 | struct slot *slot = hotplug_slot->private; | 248 | struct slot *slot = hotplug_slot->private; |
247 | 249 | ||
248 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 250 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
249 | 251 | ||
250 | *value = acpiphp_get_latch_status(slot->acpi_slot); | 252 | *value = acpiphp_get_latch_status(slot->acpi_slot); |
251 | 253 | ||
@@ -265,7 +267,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
265 | { | 267 | { |
266 | struct slot *slot = hotplug_slot->private; | 268 | struct slot *slot = hotplug_slot->private; |
267 | 269 | ||
268 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 270 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
269 | 271 | ||
270 | *value = acpiphp_get_adapter_status(slot->acpi_slot); | 272 | *value = acpiphp_get_adapter_status(slot->acpi_slot); |
271 | 273 | ||
@@ -299,7 +301,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
299 | { | 301 | { |
300 | struct slot *slot = hotplug_slot->private; | 302 | struct slot *slot = hotplug_slot->private; |
301 | 303 | ||
302 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 304 | dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
303 | 305 | ||
304 | kfree(slot->hotplug_slot); | 306 | kfree(slot->hotplug_slot); |
305 | kfree(slot); | 307 | kfree(slot); |
@@ -310,6 +312,7 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
310 | { | 312 | { |
311 | struct slot *slot; | 313 | struct slot *slot; |
312 | int retval = -ENOMEM; | 314 | int retval = -ENOMEM; |
315 | char name[SLOT_NAME_SIZE]; | ||
313 | 316 | ||
314 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | 317 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
315 | if (!slot) | 318 | if (!slot) |
@@ -321,8 +324,6 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
321 | 324 | ||
322 | slot->hotplug_slot->info = &slot->info; | 325 | slot->hotplug_slot->info = &slot->info; |
323 | 326 | ||
324 | slot->hotplug_slot->name = slot->name; | ||
325 | |||
326 | slot->hotplug_slot->private = slot; | 327 | slot->hotplug_slot->private = slot; |
327 | slot->hotplug_slot->release = &release_slot; | 328 | slot->hotplug_slot->release = &release_slot; |
328 | slot->hotplug_slot->ops = &acpi_hotplug_slot_ops; | 329 | slot->hotplug_slot->ops = &acpi_hotplug_slot_ops; |
@@ -336,11 +337,12 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
336 | slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; | 337 | slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; |
337 | 338 | ||
338 | acpiphp_slot->slot = slot; | 339 | acpiphp_slot->slot = slot; |
339 | snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun); | 340 | snprintf(name, SLOT_NAME_SIZE, "%u", slot->acpi_slot->sun); |
340 | 341 | ||
341 | retval = pci_hp_register(slot->hotplug_slot, | 342 | retval = pci_hp_register(slot->hotplug_slot, |
342 | acpiphp_slot->bridge->pci_bus, | 343 | acpiphp_slot->bridge->pci_bus, |
343 | acpiphp_slot->device); | 344 | acpiphp_slot->device, |
345 | name); | ||
344 | if (retval == -EBUSY) | 346 | if (retval == -EBUSY) |
345 | goto error_hpslot; | 347 | goto error_hpslot; |
346 | if (retval) { | 348 | if (retval) { |
@@ -348,7 +350,7 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
348 | goto error_hpslot; | 350 | goto error_hpslot; |
349 | } | 351 | } |
350 | 352 | ||
351 | info("Slot [%s] registered\n", slot->hotplug_slot->name); | 353 | info("Slot [%s] registered\n", slot_name(slot)); |
352 | 354 | ||
353 | return 0; | 355 | return 0; |
354 | error_hpslot: | 356 | error_hpslot: |
@@ -365,7 +367,7 @@ void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
365 | struct slot *slot = acpiphp_slot->slot; | 367 | struct slot *slot = acpiphp_slot->slot; |
366 | int retval = 0; | 368 | int retval = 0; |
367 | 369 | ||
368 | info ("Slot [%s] unregistered\n", slot->hotplug_slot->name); | 370 | info("Slot [%s] unregistered\n", slot_name(slot)); |
369 | 371 | ||
370 | retval = pci_hp_deregister(slot->hotplug_slot); | 372 | retval = pci_hp_deregister(slot->hotplug_slot); |
371 | if (retval) | 373 | if (retval) |