aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2008-10-20 19:41:12 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-22 19:42:39 -0400
commitdf77cd10078e36e1b89964e5e8c206add399a98d (patch)
tree97a7f3a1c5d0b3f711106f9ffcf5b7c9493848e2 /drivers/pci/hotplug
parent5fe6cc60680d29740b85278e17a002fa27b7e642 (diff)
PCI: acpiphp: remove 'name' parameter
We do not need to manage our own name parameter, especially since the PCI core can change it on our behalf, in the case of duplicate slot names. Remove 'name' from acpiphp's version of struct slot. Cc: kristen.c.accardi@intel.com Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/acpiphp.h9
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c31
2 files changed, 21 insertions, 19 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index 5a58b075dd8d..f9e244da30ae 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -50,9 +50,6 @@
50#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) 50#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
51#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 51#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
52 52
53/* name size which is used for entries in pcihpfs */
54#define SLOT_NAME_SIZE 20 /* {_SUN} */
55
56struct acpiphp_bridge; 53struct acpiphp_bridge;
57struct acpiphp_slot; 54struct acpiphp_slot;
58 55
@@ -63,9 +60,13 @@ struct slot {
63 struct hotplug_slot *hotplug_slot; 60 struct hotplug_slot *hotplug_slot;
64 struct acpiphp_slot *acpi_slot; 61 struct acpiphp_slot *acpi_slot;
65 struct hotplug_slot_info info; 62 struct hotplug_slot_info info;
66 char name[SLOT_NAME_SIZE];
67}; 63};
68 64
65static inline const char *slot_name(struct slot *slot)
66{
67 return hotplug_slot_name(slot->hotplug_slot);
68}
69
69/* 70/*
70 * struct acpiphp_bridge - PCI bridge information 71 * struct acpiphp_bridge - PCI bridge information
71 * 72 *
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index e9841765339f..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
47static int debug; 50static int debug;
48int acpiphp_debug; 51int 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,12 +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,
344 slot->name); 345 name);
345 if (retval == -EBUSY) 346 if (retval == -EBUSY)
346 goto error_hpslot; 347 goto error_hpslot;
347 if (retval) { 348 if (retval) {
@@ -349,7 +350,7 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
349 goto error_hpslot; 350 goto error_hpslot;
350 } 351 }
351 352
352 info("Slot [%s] registered\n", slot->hotplug_slot->name); 353 info("Slot [%s] registered\n", slot_name(slot));
353 354
354 return 0; 355 return 0;
355error_hpslot: 356error_hpslot:
@@ -366,7 +367,7 @@ void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
366 struct slot *slot = acpiphp_slot->slot; 367 struct slot *slot = acpiphp_slot->slot;
367 int retval = 0; 368 int retval = 0;
368 369
369 info ("Slot [%s] unregistered\n", slot->hotplug_slot->name); 370 info("Slot [%s] unregistered\n", slot_name(slot));
370 371
371 retval = pci_hp_deregister(slot->hotplug_slot); 372 retval = pci_hp_deregister(slot->hotplug_slot);
372 if (retval) 373 if (retval)