aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/pciehp.h9
-rw-r--r--drivers/pci/hotplug/pciehp_core.c33
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c53
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c1
4 files changed, 52 insertions, 44 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index c367978bd7fe..394f99852e6d 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -74,15 +74,13 @@ extern struct workqueue_struct *pciehp_wq;
74struct slot { 74struct slot {
75 u8 bus; 75 u8 bus;
76 u8 device; 76 u8 device;
77 u32 number;
78 u8 state; 77 u8 state;
79 struct timer_list task_event;
80 u8 hp_slot; 78 u8 hp_slot;
79 u32 number;
81 struct controller *ctrl; 80 struct controller *ctrl;
82 struct hpc_ops *hpc_ops; 81 struct hpc_ops *hpc_ops;
83 struct hotplug_slot *hotplug_slot; 82 struct hotplug_slot *hotplug_slot;
84 struct list_head slot_list; 83 struct list_head slot_list;
85 char name[SLOT_NAME_SIZE];
86 unsigned long last_emi_toggle; 84 unsigned long last_emi_toggle;
87 struct delayed_work work; /* work for button event */ 85 struct delayed_work work; /* work for button event */
88 struct mutex lock; 86 struct mutex lock;
@@ -175,6 +173,11 @@ int pciehp_enable_slot(struct slot *p_slot);
175int pciehp_disable_slot(struct slot *p_slot); 173int pciehp_disable_slot(struct slot *p_slot);
176int pcie_enable_notification(struct controller *ctrl); 174int pcie_enable_notification(struct controller *ctrl);
177 175
176static inline const char *slot_name(struct slot *slot)
177{
178 return hotplug_slot_name(slot->hotplug_slot);
179}
180
178static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) 181static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
179{ 182{
180 struct slot *slot; 183 struct slot *slot;
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index af89d7bd1edd..62be1b59c74b 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -185,7 +185,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
185 struct slot *slot = hotplug_slot->private; 185 struct slot *slot = hotplug_slot->private;
186 186
187 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 187 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
188 __func__, hotplug_slot->name); 188 __func__, hotplug_slot_name(hotplug_slot));
189 189
190 kfree(hotplug_slot->info); 190 kfree(hotplug_slot->info);
191 kfree(hotplug_slot); 191 kfree(hotplug_slot);
@@ -196,6 +196,7 @@ static int init_slots(struct controller *ctrl)
196 struct slot *slot; 196 struct slot *slot;
197 struct hotplug_slot *hotplug_slot; 197 struct hotplug_slot *hotplug_slot;
198 struct hotplug_slot_info *info; 198 struct hotplug_slot_info *info;
199 char name[SLOT_NAME_SIZE];
199 int retval = -ENOMEM; 200 int retval = -ENOMEM;
200 201
201 list_for_each_entry(slot, &ctrl->slot_list, slot_list) { 202 list_for_each_entry(slot, &ctrl->slot_list, slot_list) {
@@ -209,15 +210,11 @@ static int init_slots(struct controller *ctrl)
209 210
210 /* register this slot with the hotplug pci core */ 211 /* register this slot with the hotplug pci core */
211 hotplug_slot->info = info; 212 hotplug_slot->info = info;
212 hotplug_slot->name = slot->name;
213 hotplug_slot->private = slot; 213 hotplug_slot->private = slot;
214 hotplug_slot->release = &release_slot; 214 hotplug_slot->release = &release_slot;
215 hotplug_slot->ops = &pciehp_hotplug_slot_ops; 215 hotplug_slot->ops = &pciehp_hotplug_slot_ops;
216 get_power_status(hotplug_slot, &info->power_status);
217 get_attention_status(hotplug_slot, &info->attention_status);
218 get_latch_status(hotplug_slot, &info->latch_status);
219 get_adapter_status(hotplug_slot, &info->adapter_status);
220 slot->hotplug_slot = hotplug_slot; 216 slot->hotplug_slot = hotplug_slot;
217 snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
221 218
222 ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x " 219 ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
223 "slot_device_offset=%x\n", slot->bus, slot->device, 220 "slot_device_offset=%x\n", slot->bus, slot->device,
@@ -225,12 +222,16 @@ static int init_slots(struct controller *ctrl)
225 retval = pci_hp_register(hotplug_slot, 222 retval = pci_hp_register(hotplug_slot,
226 ctrl->pci_dev->subordinate, 223 ctrl->pci_dev->subordinate,
227 slot->device, 224 slot->device,
228 slot->name); 225 name);
229 if (retval) { 226 if (retval) {
230 ctrl_err(ctrl, "pci_hp_register failed with error %d\n", 227 ctrl_err(ctrl, "pci_hp_register failed with error %d\n",
231 retval); 228 retval);
232 goto error_info; 229 goto error_info;
233 } 230 }
231 get_power_status(hotplug_slot, &info->power_status);
232 get_attention_status(hotplug_slot, &info->attention_status);
233 get_latch_status(hotplug_slot, &info->latch_status);
234 get_adapter_status(hotplug_slot, &info->adapter_status);
234 /* create additional sysfs entries */ 235 /* create additional sysfs entries */
235 if (EMI(ctrl)) { 236 if (EMI(ctrl)) {
236 retval = sysfs_create_file(&hotplug_slot->pci_slot->kobj, 237 retval = sysfs_create_file(&hotplug_slot->pci_slot->kobj,
@@ -273,7 +274,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
273 struct slot *slot = hotplug_slot->private; 274 struct slot *slot = hotplug_slot->private;
274 275
275 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 276 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
276 __func__, hotplug_slot->name); 277 __func__, slot_name(slot));
277 278
278 hotplug_slot->info->attention_status = status; 279 hotplug_slot->info->attention_status = status;
279 280
@@ -289,7 +290,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
289 struct slot *slot = hotplug_slot->private; 290 struct slot *slot = hotplug_slot->private;
290 291
291 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 292 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
292 __func__, hotplug_slot->name); 293 __func__, slot_name(slot));
293 294
294 return pciehp_sysfs_enable_slot(slot); 295 return pciehp_sysfs_enable_slot(slot);
295} 296}
@@ -300,7 +301,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
300 struct slot *slot = hotplug_slot->private; 301 struct slot *slot = hotplug_slot->private;
301 302
302 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 303 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
303 __func__, hotplug_slot->name); 304 __func__, slot_name(slot));
304 305
305 return pciehp_sysfs_disable_slot(slot); 306 return pciehp_sysfs_disable_slot(slot);
306} 307}
@@ -311,7 +312,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
311 int retval; 312 int retval;
312 313
313 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 314 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
314 __func__, hotplug_slot->name); 315 __func__, slot_name(slot));
315 316
316 retval = slot->hpc_ops->get_power_status(slot, value); 317 retval = slot->hpc_ops->get_power_status(slot, value);
317 if (retval < 0) 318 if (retval < 0)
@@ -326,7 +327,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
326 int retval; 327 int retval;
327 328
328 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 329 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
329 __func__, hotplug_slot->name); 330 __func__, slot_name(slot));
330 331
331 retval = slot->hpc_ops->get_attention_status(slot, value); 332 retval = slot->hpc_ops->get_attention_status(slot, value);
332 if (retval < 0) 333 if (retval < 0)
@@ -341,7 +342,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
341 int retval; 342 int retval;
342 343
343 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 344 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
344 __func__, hotplug_slot->name); 345 __func__, slot_name(slot));
345 346
346 retval = slot->hpc_ops->get_latch_status(slot, value); 347 retval = slot->hpc_ops->get_latch_status(slot, value);
347 if (retval < 0) 348 if (retval < 0)
@@ -356,7 +357,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
356 int retval; 357 int retval;
357 358
358 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 359 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
359 __func__, hotplug_slot->name); 360 __func__, slot_name(slot));
360 361
361 retval = slot->hpc_ops->get_adapter_status(slot, value); 362 retval = slot->hpc_ops->get_adapter_status(slot, value);
362 if (retval < 0) 363 if (retval < 0)
@@ -372,7 +373,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
372 int retval; 373 int retval;
373 374
374 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 375 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
375 __func__, hotplug_slot->name); 376 __func__, slot_name(slot));
376 377
377 retval = slot->hpc_ops->get_max_bus_speed(slot, value); 378 retval = slot->hpc_ops->get_max_bus_speed(slot, value);
378 if (retval < 0) 379 if (retval < 0)
@@ -387,7 +388,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
387 int retval; 388 int retval;
388 389
389 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 390 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
390 __func__, hotplug_slot->name); 391 __func__, slot_name(slot));
391 392
392 retval = slot->hpc_ops->get_cur_bus_speed(slot, value); 393 retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
393 if (retval < 0) 394 if (retval < 0)
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index acb7f9efd182..cce6e5f659e8 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -66,7 +66,7 @@ u8 pciehp_handle_attention_button(struct slot *p_slot)
66 /* 66 /*
67 * Button pressed - See if need to TAKE ACTION!!! 67 * Button pressed - See if need to TAKE ACTION!!!
68 */ 68 */
69 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", p_slot->name); 69 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
70 event_type = INT_BUTTON_PRESS; 70 event_type = INT_BUTTON_PRESS;
71 71
72 queue_interrupt_event(p_slot, event_type); 72 queue_interrupt_event(p_slot, event_type);
@@ -88,13 +88,13 @@ u8 pciehp_handle_switch_change(struct slot *p_slot)
88 /* 88 /*
89 * Switch opened 89 * Switch opened
90 */ 90 */
91 ctrl_info(ctrl, "Latch open on Slot(%s)\n", p_slot->name); 91 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
92 event_type = INT_SWITCH_OPEN; 92 event_type = INT_SWITCH_OPEN;
93 } else { 93 } else {
94 /* 94 /*
95 * Switch closed 95 * Switch closed
96 */ 96 */
97 ctrl_info(ctrl, "Latch close on Slot(%s)\n", p_slot->name); 97 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
98 event_type = INT_SWITCH_CLOSE; 98 event_type = INT_SWITCH_CLOSE;
99 } 99 }
100 100
@@ -120,13 +120,14 @@ u8 pciehp_handle_presence_change(struct slot *p_slot)
120 /* 120 /*
121 * Card Present 121 * Card Present
122 */ 122 */
123 ctrl_info(ctrl, "Card present on Slot(%s)\n", p_slot->name); 123 ctrl_info(ctrl, "Card present on Slot(%s)\n", slot_name(p_slot));
124 event_type = INT_PRESENCE_ON; 124 event_type = INT_PRESENCE_ON;
125 } else { 125 } else {
126 /* 126 /*
127 * Not Present 127 * Not Present
128 */ 128 */
129 ctrl_info(ctrl, "Card not present on Slot(%s)\n", p_slot->name); 129 ctrl_info(ctrl, "Card not present on Slot(%s)\n",
130 slot_name(p_slot));
130 event_type = INT_PRESENCE_OFF; 131 event_type = INT_PRESENCE_OFF;
131 } 132 }
132 133
@@ -148,13 +149,13 @@ u8 pciehp_handle_power_fault(struct slot *p_slot)
148 * power fault Cleared 149 * power fault Cleared
149 */ 150 */
150 ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n", 151 ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n",
151 p_slot->name); 152 slot_name(p_slot));
152 event_type = INT_POWER_FAULT_CLEAR; 153 event_type = INT_POWER_FAULT_CLEAR;
153 } else { 154 } else {
154 /* 155 /*
155 * power fault 156 * power fault
156 */ 157 */
157 ctrl_info(ctrl, "Power fault on Slot(%s)\n", p_slot->name); 158 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
158 event_type = INT_POWER_FAULT; 159 event_type = INT_POWER_FAULT;
159 ctrl_info(ctrl, "power fault bit %x set\n", 0); 160 ctrl_info(ctrl, "power fault bit %x set\n", 0);
160 } 161 }
@@ -412,12 +413,12 @@ static void handle_button_press_event(struct slot *p_slot)
412 p_slot->state = BLINKINGOFF_STATE; 413 p_slot->state = BLINKINGOFF_STATE;
413 ctrl_info(ctrl, 414 ctrl_info(ctrl,
414 "PCI slot #%s - powering off due to button " 415 "PCI slot #%s - powering off due to button "
415 "press.\n", p_slot->name); 416 "press.\n", slot_name(p_slot));
416 } else { 417 } else {
417 p_slot->state = BLINKINGON_STATE; 418 p_slot->state = BLINKINGON_STATE;
418 ctrl_info(ctrl, 419 ctrl_info(ctrl,
419 "PCI slot #%s - powering on due to button " 420 "PCI slot #%s - powering on due to button "
420 "press.\n", p_slot->name); 421 "press.\n", slot_name(p_slot));
421 } 422 }
422 /* blink green LED and turn off amber */ 423 /* blink green LED and turn off amber */
423 if (PWR_LED(ctrl)) 424 if (PWR_LED(ctrl))
@@ -434,7 +435,7 @@ static void handle_button_press_event(struct slot *p_slot)
434 * press the attention again before the 5 sec. limit 435 * press the attention again before the 5 sec. limit
435 * expires to cancel hot-add or hot-remove 436 * expires to cancel hot-add or hot-remove
436 */ 437 */
437 ctrl_info(ctrl, "Button cancel on Slot(%s)\n", p_slot->name); 438 ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot));
438 ctrl_dbg(ctrl, "%s: button cancel\n", __func__); 439 ctrl_dbg(ctrl, "%s: button cancel\n", __func__);
439 cancel_delayed_work(&p_slot->work); 440 cancel_delayed_work(&p_slot->work);
440 if (p_slot->state == BLINKINGOFF_STATE) { 441 if (p_slot->state == BLINKINGOFF_STATE) {
@@ -447,7 +448,7 @@ static void handle_button_press_event(struct slot *p_slot)
447 if (ATTN_LED(ctrl)) 448 if (ATTN_LED(ctrl))
448 p_slot->hpc_ops->set_attention_status(p_slot, 0); 449 p_slot->hpc_ops->set_attention_status(p_slot, 0);
449 ctrl_info(ctrl, "PCI slot #%s - action canceled " 450 ctrl_info(ctrl, "PCI slot #%s - action canceled "
450 "due to button press\n", p_slot->name); 451 "due to button press\n", slot_name(p_slot));
451 p_slot->state = STATIC_STATE; 452 p_slot->state = STATIC_STATE;
452 break; 453 break;
453 case POWEROFF_STATE: 454 case POWEROFF_STATE:
@@ -457,7 +458,7 @@ static void handle_button_press_event(struct slot *p_slot)
457 * this means that the previous attention button action 458 * this means that the previous attention button action
458 * to hot-add or hot-remove is undergoing 459 * to hot-add or hot-remove is undergoing
459 */ 460 */
460 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", p_slot->name); 461 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot));
461 update_slot_info(p_slot); 462 update_slot_info(p_slot);
462 break; 463 break;
463 default: 464 default:
@@ -540,7 +541,7 @@ int pciehp_enable_slot(struct slot *p_slot)
540 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 541 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
541 if (rc || !getstatus) { 542 if (rc || !getstatus) {
542 ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", 543 ctrl_info(ctrl, "%s: no adapter on slot(%s)\n",
543 __func__, p_slot->name); 544 __func__, slot_name(p_slot));
544 mutex_unlock(&p_slot->ctrl->crit_sect); 545 mutex_unlock(&p_slot->ctrl->crit_sect);
545 return -ENODEV; 546 return -ENODEV;
546 } 547 }
@@ -548,7 +549,7 @@ int pciehp_enable_slot(struct slot *p_slot)
548 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 549 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
549 if (rc || getstatus) { 550 if (rc || getstatus) {
550 ctrl_info(ctrl, "%s: latch open on slot(%s)\n", 551 ctrl_info(ctrl, "%s: latch open on slot(%s)\n",
551 __func__, p_slot->name); 552 __func__, slot_name(p_slot));
552 mutex_unlock(&p_slot->ctrl->crit_sect); 553 mutex_unlock(&p_slot->ctrl->crit_sect);
553 return -ENODEV; 554 return -ENODEV;
554 } 555 }
@@ -558,7 +559,7 @@ int pciehp_enable_slot(struct slot *p_slot)
558 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 559 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
559 if (rc || getstatus) { 560 if (rc || getstatus) {
560 ctrl_info(ctrl, "%s: already enabled on slot(%s)\n", 561 ctrl_info(ctrl, "%s: already enabled on slot(%s)\n",
561 __func__, p_slot->name); 562 __func__, slot_name(p_slot));
562 mutex_unlock(&p_slot->ctrl->crit_sect); 563 mutex_unlock(&p_slot->ctrl->crit_sect);
563 return -EINVAL; 564 return -EINVAL;
564 } 565 }
@@ -594,7 +595,7 @@ int pciehp_disable_slot(struct slot *p_slot)
594 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 595 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
595 if (ret || !getstatus) { 596 if (ret || !getstatus) {
596 ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", 597 ctrl_info(ctrl, "%s: no adapter on slot(%s)\n",
597 __func__, p_slot->name); 598 __func__, slot_name(p_slot));
598 mutex_unlock(&p_slot->ctrl->crit_sect); 599 mutex_unlock(&p_slot->ctrl->crit_sect);
599 return -ENODEV; 600 return -ENODEV;
600 } 601 }
@@ -604,7 +605,7 @@ int pciehp_disable_slot(struct slot *p_slot)
604 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 605 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
605 if (ret || getstatus) { 606 if (ret || getstatus) {
606 ctrl_info(ctrl, "%s: latch open on slot(%s)\n", 607 ctrl_info(ctrl, "%s: latch open on slot(%s)\n",
607 __func__, p_slot->name); 608 __func__, slot_name(p_slot));
608 mutex_unlock(&p_slot->ctrl->crit_sect); 609 mutex_unlock(&p_slot->ctrl->crit_sect);
609 return -ENODEV; 610 return -ENODEV;
610 } 611 }
@@ -614,7 +615,7 @@ int pciehp_disable_slot(struct slot *p_slot)
614 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 615 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
615 if (ret || !getstatus) { 616 if (ret || !getstatus) {
616 ctrl_info(ctrl, "%s: already disabled slot(%s)\n", 617 ctrl_info(ctrl, "%s: already disabled slot(%s)\n",
617 __func__, p_slot->name); 618 __func__, slot_name(p_slot));
618 mutex_unlock(&p_slot->ctrl->crit_sect); 619 mutex_unlock(&p_slot->ctrl->crit_sect);
619 return -EINVAL; 620 return -EINVAL;
620 } 621 }
@@ -645,14 +646,16 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot)
645 break; 646 break;
646 case POWERON_STATE: 647 case POWERON_STATE:
647 ctrl_info(ctrl, "Slot %s is already in powering on state\n", 648 ctrl_info(ctrl, "Slot %s is already in powering on state\n",
648 p_slot->name); 649 slot_name(p_slot));
649 break; 650 break;
650 case BLINKINGOFF_STATE: 651 case BLINKINGOFF_STATE:
651 case POWEROFF_STATE: 652 case POWEROFF_STATE:
652 ctrl_info(ctrl, "Already enabled on slot %s\n", p_slot->name); 653 ctrl_info(ctrl, "Already enabled on slot %s\n",
654 slot_name(p_slot));
653 break; 655 break;
654 default: 656 default:
655 ctrl_err(ctrl, "Not a valid state on slot %s\n", p_slot->name); 657 ctrl_err(ctrl, "Not a valid state on slot %s\n",
658 slot_name(p_slot));
656 break; 659 break;
657 } 660 }
658 mutex_unlock(&p_slot->lock); 661 mutex_unlock(&p_slot->lock);
@@ -678,14 +681,16 @@ int pciehp_sysfs_disable_slot(struct slot *p_slot)
678 break; 681 break;
679 case POWEROFF_STATE: 682 case POWEROFF_STATE:
680 ctrl_info(ctrl, "Slot %s is already in powering off state\n", 683 ctrl_info(ctrl, "Slot %s is already in powering off state\n",
681 p_slot->name); 684 slot_name(p_slot));
682 break; 685 break;
683 case BLINKINGON_STATE: 686 case BLINKINGON_STATE:
684 case POWERON_STATE: 687 case POWERON_STATE:
685 ctrl_info(ctrl, "Already disabled on slot %s\n", p_slot->name); 688 ctrl_info(ctrl, "Already disabled on slot %s\n",
689 slot_name(p_slot));
686 break; 690 break;
687 default: 691 default:
688 ctrl_err(ctrl, "Not a valid state on slot %s\n", p_slot->name); 692 ctrl_err(ctrl, "Not a valid state on slot %s\n",
693 slot_name(p_slot));
689 break; 694 break;
690 } 695 }
691 mutex_unlock(&p_slot->lock); 696 mutex_unlock(&p_slot->lock);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 8e9530c4c36d..4c74d536d45c 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1061,7 +1061,6 @@ static int pcie_init_slot(struct controller *ctrl)
1061 slot->device = ctrl->slot_device_offset + slot->hp_slot; 1061 slot->device = ctrl->slot_device_offset + slot->hp_slot;
1062 slot->hpc_ops = ctrl->hpc_ops; 1062 slot->hpc_ops = ctrl->hpc_ops;
1063 slot->number = ctrl->first_slot; 1063 slot->number = ctrl->first_slot;
1064 snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number);
1065 mutex_init(&slot->lock); 1064 mutex_init(&slot->lock);
1066 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); 1065 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
1067 list_add(&slot->slot_list, &ctrl->slot_list); 1066 list_add(&slot->slot_list, &ctrl->slot_list);