aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-12-14 15:06:16 -0500
committerBjorn Helgaas <bhelgaas@google.com>2013-12-15 18:07:32 -0500
commit6dae62020f0e6a2ffe424c8cea542fa49d42ec6e (patch)
tree57f76e124dcccc1a84dfe0655e213d3a28351e91 /drivers/pci/hotplug
parent1a84b99ccbb954ce201024691babfe4d7d9f506f (diff)
PCI: pciehp: Make various functions void since they can't fail
These functions: pcie_enable_notification() pciehp_power_off_slot() pciehp_get_power_status() pciehp_get_attention_status() pciehp_set_attention_status() pciehp_get_latch_status() pciehp_get_adapter_status() pcie_write_cmd() now always return success, so this patch makes them void and drops the error-checking code in their callers. No functional change. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/pciehp.h14
-rw-r--r--drivers/pci/hotplug/pciehp_core.c15
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c52
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c56
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c6
5 files changed, 54 insertions, 89 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 21e865ded1dc..ffe6a6b336cf 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -140,15 +140,15 @@ struct controller *pcie_init(struct pcie_device *dev);
140int pcie_init_notification(struct controller *ctrl); 140int pcie_init_notification(struct controller *ctrl);
141int pciehp_enable_slot(struct slot *p_slot); 141int pciehp_enable_slot(struct slot *p_slot);
142int pciehp_disable_slot(struct slot *p_slot); 142int pciehp_disable_slot(struct slot *p_slot);
143int pcie_enable_notification(struct controller *ctrl); 143void pcie_enable_notification(struct controller *ctrl);
144int pciehp_power_on_slot(struct slot *slot); 144int pciehp_power_on_slot(struct slot *slot);
145int pciehp_power_off_slot(struct slot *slot); 145void pciehp_power_off_slot(struct slot *slot);
146int pciehp_get_power_status(struct slot *slot, u8 *status); 146void pciehp_get_power_status(struct slot *slot, u8 *status);
147int pciehp_get_attention_status(struct slot *slot, u8 *status); 147void pciehp_get_attention_status(struct slot *slot, u8 *status);
148 148
149int pciehp_set_attention_status(struct slot *slot, u8 status); 149void pciehp_set_attention_status(struct slot *slot, u8 status);
150int pciehp_get_latch_status(struct slot *slot, u8 *status); 150void pciehp_get_latch_status(struct slot *slot, u8 *status);
151int pciehp_get_adapter_status(struct slot *slot, u8 *status); 151void pciehp_get_adapter_status(struct slot *slot, u8 *status);
152int pciehp_query_power_fault(struct slot *slot); 152int pciehp_query_power_fault(struct slot *slot);
153void pciehp_green_led_on(struct slot *slot); 153void pciehp_green_led_on(struct slot *slot);
154void pciehp_green_led_off(struct slot *slot); 154void pciehp_green_led_off(struct slot *slot);
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index bbd48bbe4e9b..143a389d81fa 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -160,7 +160,8 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
160 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 160 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
161 __func__, slot_name(slot)); 161 __func__, slot_name(slot));
162 162
163 return pciehp_set_attention_status(slot, status); 163 pciehp_set_attention_status(slot, status);
164 return 0;
164} 165}
165 166
166 167
@@ -192,7 +193,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
192 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 193 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
193 __func__, slot_name(slot)); 194 __func__, slot_name(slot));
194 195
195 return pciehp_get_power_status(slot, value); 196 pciehp_get_power_status(slot, value);
197 return 0;
196} 198}
197 199
198static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 200static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
@@ -202,7 +204,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
202 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 204 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
203 __func__, slot_name(slot)); 205 __func__, slot_name(slot));
204 206
205 return pciehp_get_attention_status(slot, value); 207 pciehp_get_attention_status(slot, value);
208 return 0;
206} 209}
207 210
208static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 211static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
@@ -212,7 +215,8 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
212 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 215 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
213 __func__, slot_name(slot)); 216 __func__, slot_name(slot));
214 217
215 return pciehp_get_latch_status(slot, value); 218 pciehp_get_latch_status(slot, value);
219 return 0;
216} 220}
217 221
218static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 222static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
@@ -222,7 +226,8 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
222 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 226 ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
223 __func__, slot_name(slot)); 227 __func__, slot_name(slot));
224 228
225 return pciehp_get_adapter_status(slot, value); 229 pciehp_get_adapter_status(slot, value);
230 return 0;
226} 231}
227 232
228static int reset_slot(struct hotplug_slot *hotplug_slot, int probe) 233static int reset_slot(struct hotplug_slot *hotplug_slot, int probe)
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 38f018679175..6c730b161b33 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -158,11 +158,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
158{ 158{
159 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ 159 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/
160 if (POWER_CTRL(ctrl)) { 160 if (POWER_CTRL(ctrl)) {
161 if (pciehp_power_off_slot(pslot)) { 161 pciehp_power_off_slot(pslot);
162 ctrl_err(ctrl, 162
163 "Issue of Slot Power Off command failed\n");
164 return;
165 }
166 /* 163 /*
167 * After turning power off, we must wait for at least 1 second 164 * After turning power off, we must wait for at least 1 second
168 * before taking any action that relies on power having been 165 * before taking any action that relies on power having been
@@ -174,13 +171,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
174 if (PWR_LED(ctrl)) 171 if (PWR_LED(ctrl))
175 pciehp_green_led_off(pslot); 172 pciehp_green_led_off(pslot);
176 173
177 if (ATTN_LED(ctrl)) { 174 if (ATTN_LED(ctrl))
178 if (pciehp_set_attention_status(pslot, 1)) { 175 pciehp_set_attention_status(pslot, 1);
179 ctrl_err(ctrl,
180 "Issue of Set Attention Led command failed\n");
181 return;
182 }
183 }
184} 176}
185 177
186/** 178/**
@@ -243,7 +235,7 @@ err_exit:
243 */ 235 */
244static int remove_board(struct slot *p_slot) 236static int remove_board(struct slot *p_slot)
245{ 237{
246 int retval = 0; 238 int retval;
247 struct controller *ctrl = p_slot->ctrl; 239 struct controller *ctrl = p_slot->ctrl;
248 240
249 retval = pciehp_unconfigure_device(p_slot); 241 retval = pciehp_unconfigure_device(p_slot);
@@ -251,13 +243,8 @@ static int remove_board(struct slot *p_slot)
251 return retval; 243 return retval;
252 244
253 if (POWER_CTRL(ctrl)) { 245 if (POWER_CTRL(ctrl)) {
254 /* power off slot */ 246 pciehp_power_off_slot(p_slot);
255 retval = pciehp_power_off_slot(p_slot); 247
256 if (retval) {
257 ctrl_err(ctrl,
258 "Issue of Slot Disable command failed\n");
259 return retval;
260 }
261 /* 248 /*
262 * After turning power off, we must wait for at least 1 second 249 * After turning power off, we must wait for at least 1 second
263 * before taking any action that relies on power having been 250 * before taking any action that relies on power having been
@@ -482,14 +469,14 @@ int pciehp_enable_slot(struct slot *p_slot)
482 int rc; 469 int rc;
483 struct controller *ctrl = p_slot->ctrl; 470 struct controller *ctrl = p_slot->ctrl;
484 471
485 rc = pciehp_get_adapter_status(p_slot, &getstatus); 472 pciehp_get_adapter_status(p_slot, &getstatus);
486 if (rc || !getstatus) { 473 if (!getstatus) {
487 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 474 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
488 return -ENODEV; 475 return -ENODEV;
489 } 476 }
490 if (MRL_SENS(p_slot->ctrl)) { 477 if (MRL_SENS(p_slot->ctrl)) {
491 rc = pciehp_get_latch_status(p_slot, &getstatus); 478 pciehp_get_latch_status(p_slot, &getstatus);
492 if (rc || getstatus) { 479 if (getstatus) {
493 ctrl_info(ctrl, "Latch open on slot(%s)\n", 480 ctrl_info(ctrl, "Latch open on slot(%s)\n",
494 slot_name(p_slot)); 481 slot_name(p_slot));
495 return -ENODEV; 482 return -ENODEV;
@@ -497,8 +484,8 @@ int pciehp_enable_slot(struct slot *p_slot)
497 } 484 }
498 485
499 if (POWER_CTRL(p_slot->ctrl)) { 486 if (POWER_CTRL(p_slot->ctrl)) {
500 rc = pciehp_get_power_status(p_slot, &getstatus); 487 pciehp_get_power_status(p_slot, &getstatus);
501 if (rc || getstatus) { 488 if (getstatus) {
502 ctrl_info(ctrl, "Already enabled on slot(%s)\n", 489 ctrl_info(ctrl, "Already enabled on slot(%s)\n",
503 slot_name(p_slot)); 490 slot_name(p_slot));
504 return -EINVAL; 491 return -EINVAL;
@@ -518,15 +505,14 @@ int pciehp_enable_slot(struct slot *p_slot)
518int pciehp_disable_slot(struct slot *p_slot) 505int pciehp_disable_slot(struct slot *p_slot)
519{ 506{
520 u8 getstatus = 0; 507 u8 getstatus = 0;
521 int ret = 0;
522 struct controller *ctrl = p_slot->ctrl; 508 struct controller *ctrl = p_slot->ctrl;
523 509
524 if (!p_slot->ctrl) 510 if (!p_slot->ctrl)
525 return 1; 511 return 1;
526 512
527 if (!HP_SUPR_RM(p_slot->ctrl)) { 513 if (!HP_SUPR_RM(p_slot->ctrl)) {
528 ret = pciehp_get_adapter_status(p_slot, &getstatus); 514 pciehp_get_adapter_status(p_slot, &getstatus);
529 if (ret || !getstatus) { 515 if (!getstatus) {
530 ctrl_info(ctrl, "No adapter on slot(%s)\n", 516 ctrl_info(ctrl, "No adapter on slot(%s)\n",
531 slot_name(p_slot)); 517 slot_name(p_slot));
532 return -ENODEV; 518 return -ENODEV;
@@ -534,8 +520,8 @@ int pciehp_disable_slot(struct slot *p_slot)
534 } 520 }
535 521
536 if (MRL_SENS(p_slot->ctrl)) { 522 if (MRL_SENS(p_slot->ctrl)) {
537 ret = pciehp_get_latch_status(p_slot, &getstatus); 523 pciehp_get_latch_status(p_slot, &getstatus);
538 if (ret || getstatus) { 524 if (getstatus) {
539 ctrl_info(ctrl, "Latch open on slot(%s)\n", 525 ctrl_info(ctrl, "Latch open on slot(%s)\n",
540 slot_name(p_slot)); 526 slot_name(p_slot));
541 return -ENODEV; 527 return -ENODEV;
@@ -543,8 +529,8 @@ int pciehp_disable_slot(struct slot *p_slot)
543 } 529 }
544 530
545 if (POWER_CTRL(p_slot->ctrl)) { 531 if (POWER_CTRL(p_slot->ctrl)) {
546 ret = pciehp_get_power_status(p_slot, &getstatus); 532 pciehp_get_power_status(p_slot, &getstatus);
547 if (ret || !getstatus) { 533 if (!getstatus) {
548 ctrl_info(ctrl, "Already disabled on slot(%s)\n", 534 ctrl_info(ctrl, "Already disabled on slot(%s)\n",
549 slot_name(p_slot)); 535 slot_name(p_slot));
550 return -EINVAL; 536 return -EINVAL;
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 6afdd2358227..83df74910f9a 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -153,7 +153,7 @@ static void pcie_wait_cmd(struct controller *ctrl, int poll)
153 * @cmd: command value written to slot control register 153 * @cmd: command value written to slot control register
154 * @mask: bitmask of slot control register to be modified 154 * @mask: bitmask of slot control register to be modified
155 */ 155 */
156static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) 156static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
157{ 157{
158 struct pci_dev *pdev = ctrl_dev(ctrl); 158 struct pci_dev *pdev = ctrl_dev(ctrl);
159 u16 slot_status; 159 u16 slot_status;
@@ -208,7 +208,6 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
208 pcie_wait_cmd(ctrl, poll); 208 pcie_wait_cmd(ctrl, poll);
209 } 209 }
210 mutex_unlock(&ctrl->ctrl_lock); 210 mutex_unlock(&ctrl->ctrl_lock);
211 return 0;
212} 211}
213 212
214static bool check_link_active(struct controller *ctrl) 213static bool check_link_active(struct controller *ctrl)
@@ -342,7 +341,7 @@ static int pciehp_link_disable(struct controller *ctrl)
342 return __pciehp_link_set(ctrl, false); 341 return __pciehp_link_set(ctrl, false);
343} 342}
344 343
345int pciehp_get_attention_status(struct slot *slot, u8 *status) 344void pciehp_get_attention_status(struct slot *slot, u8 *status)
346{ 345{
347 struct controller *ctrl = slot->ctrl; 346 struct controller *ctrl = slot->ctrl;
348 struct pci_dev *pdev = ctrl_dev(ctrl); 347 struct pci_dev *pdev = ctrl_dev(ctrl);
@@ -372,11 +371,9 @@ int pciehp_get_attention_status(struct slot *slot, u8 *status)
372 *status = 0xFF; 371 *status = 0xFF;
373 break; 372 break;
374 } 373 }
375
376 return 0;
377} 374}
378 375
379int pciehp_get_power_status(struct slot *slot, u8 *status) 376void pciehp_get_power_status(struct slot *slot, u8 *status)
380{ 377{
381 struct controller *ctrl = slot->ctrl; 378 struct controller *ctrl = slot->ctrl;
382 struct pci_dev *pdev = ctrl_dev(ctrl); 379 struct pci_dev *pdev = ctrl_dev(ctrl);
@@ -400,28 +397,24 @@ int pciehp_get_power_status(struct slot *slot, u8 *status)
400 *status = 0xFF; 397 *status = 0xFF;
401 break; 398 break;
402 } 399 }
403
404 return 0;
405} 400}
406 401
407int pciehp_get_latch_status(struct slot *slot, u8 *status) 402void pciehp_get_latch_status(struct slot *slot, u8 *status)
408{ 403{
409 struct pci_dev *pdev = ctrl_dev(slot->ctrl); 404 struct pci_dev *pdev = ctrl_dev(slot->ctrl);
410 u16 slot_status; 405 u16 slot_status;
411 406
412 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); 407 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
413 *status = !!(slot_status & PCI_EXP_SLTSTA_MRLSS); 408 *status = !!(slot_status & PCI_EXP_SLTSTA_MRLSS);
414 return 0;
415} 409}
416 410
417int pciehp_get_adapter_status(struct slot *slot, u8 *status) 411void pciehp_get_adapter_status(struct slot *slot, u8 *status)
418{ 412{
419 struct pci_dev *pdev = ctrl_dev(slot->ctrl); 413 struct pci_dev *pdev = ctrl_dev(slot->ctrl);
420 u16 slot_status; 414 u16 slot_status;
421 415
422 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); 416 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
423 *status = !!(slot_status & PCI_EXP_SLTSTA_PDS); 417 *status = !!(slot_status & PCI_EXP_SLTSTA_PDS);
424 return 0;
425} 418}
426 419
427int pciehp_query_power_fault(struct slot *slot) 420int pciehp_query_power_fault(struct slot *slot)
@@ -433,7 +426,7 @@ int pciehp_query_power_fault(struct slot *slot)
433 return !!(slot_status & PCI_EXP_SLTSTA_PFD); 426 return !!(slot_status & PCI_EXP_SLTSTA_PFD);
434} 427}
435 428
436int pciehp_set_attention_status(struct slot *slot, u8 value) 429void pciehp_set_attention_status(struct slot *slot, u8 value)
437{ 430{
438 struct controller *ctrl = slot->ctrl; 431 struct controller *ctrl = slot->ctrl;
439 u16 slot_cmd; 432 u16 slot_cmd;
@@ -451,11 +444,11 @@ int pciehp_set_attention_status(struct slot *slot, u8 value)
451 slot_cmd = 0x0080; 444 slot_cmd = 0x0080;
452 break; 445 break;
453 default: 446 default:
454 return -EINVAL; 447 return;
455 } 448 }
456 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, 449 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
457 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); 450 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
458 return pcie_write_cmd(ctrl, slot_cmd, cmd_mask); 451 pcie_write_cmd(ctrl, slot_cmd, cmd_mask);
459} 452}
460 453
461void pciehp_green_led_on(struct slot *slot) 454void pciehp_green_led_on(struct slot *slot)
@@ -515,11 +508,7 @@ int pciehp_power_on_slot(struct slot * slot)
515 508
516 slot_cmd = POWER_ON; 509 slot_cmd = POWER_ON;
517 cmd_mask = PCI_EXP_SLTCTL_PCC; 510 cmd_mask = PCI_EXP_SLTCTL_PCC;
518 retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); 511 pcie_write_cmd(ctrl, slot_cmd, cmd_mask);
519 if (retval) {
520 ctrl_err(ctrl, "Write %x command failed!\n", slot_cmd);
521 return retval;
522 }
523 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, 512 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
524 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); 513 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
525 514
@@ -530,12 +519,11 @@ int pciehp_power_on_slot(struct slot * slot)
530 return retval; 519 return retval;
531} 520}
532 521
533int pciehp_power_off_slot(struct slot * slot) 522void pciehp_power_off_slot(struct slot * slot)
534{ 523{
535 struct controller *ctrl = slot->ctrl; 524 struct controller *ctrl = slot->ctrl;
536 u16 slot_cmd; 525 u16 slot_cmd;
537 u16 cmd_mask; 526 u16 cmd_mask;
538 int retval;
539 527
540 /* Disable the link at first */ 528 /* Disable the link at first */
541 pciehp_link_disable(ctrl); 529 pciehp_link_disable(ctrl);
@@ -547,14 +535,9 @@ int pciehp_power_off_slot(struct slot * slot)
547 535
548 slot_cmd = POWER_OFF; 536 slot_cmd = POWER_OFF;
549 cmd_mask = PCI_EXP_SLTCTL_PCC; 537 cmd_mask = PCI_EXP_SLTCTL_PCC;
550 retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); 538 pcie_write_cmd(ctrl, slot_cmd, cmd_mask);
551 if (retval) {
552 ctrl_err(ctrl, "Write command failed!\n");
553 return retval;
554 }
555 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, 539 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
556 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); 540 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
557 return 0;
558} 541}
559 542
560static irqreturn_t pcie_isr(int irq, void *dev_id) 543static irqreturn_t pcie_isr(int irq, void *dev_id)
@@ -617,7 +600,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
617 return IRQ_HANDLED; 600 return IRQ_HANDLED;
618} 601}
619 602
620int pcie_enable_notification(struct controller *ctrl) 603void pcie_enable_notification(struct controller *ctrl)
621{ 604{
622 u16 cmd, mask; 605 u16 cmd, mask;
623 606
@@ -643,22 +626,18 @@ int pcie_enable_notification(struct controller *ctrl)
643 PCI_EXP_SLTCTL_MRLSCE | PCI_EXP_SLTCTL_PFDE | 626 PCI_EXP_SLTCTL_MRLSCE | PCI_EXP_SLTCTL_PFDE |
644 PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE); 627 PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE);
645 628
646 if (pcie_write_cmd(ctrl, cmd, mask)) { 629 pcie_write_cmd(ctrl, cmd, mask);
647 ctrl_err(ctrl, "Cannot enable software notification\n");
648 return -1;
649 }
650 return 0;
651} 630}
652 631
653static void pcie_disable_notification(struct controller *ctrl) 632static void pcie_disable_notification(struct controller *ctrl)
654{ 633{
655 u16 mask; 634 u16 mask;
635
656 mask = (PCI_EXP_SLTCTL_PDCE | PCI_EXP_SLTCTL_ABPE | 636 mask = (PCI_EXP_SLTCTL_PDCE | PCI_EXP_SLTCTL_ABPE |
657 PCI_EXP_SLTCTL_MRLSCE | PCI_EXP_SLTCTL_PFDE | 637 PCI_EXP_SLTCTL_MRLSCE | PCI_EXP_SLTCTL_PFDE |
658 PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE | 638 PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE |
659 PCI_EXP_SLTCTL_DLLSCE); 639 PCI_EXP_SLTCTL_DLLSCE);
660 if (pcie_write_cmd(ctrl, 0, mask)) 640 pcie_write_cmd(ctrl, 0, mask);
661 ctrl_warn(ctrl, "Cannot disable software notification\n");
662} 641}
663 642
664/* 643/*
@@ -698,10 +677,7 @@ int pcie_init_notification(struct controller *ctrl)
698{ 677{
699 if (pciehp_request_irq(ctrl)) 678 if (pciehp_request_irq(ctrl))
700 return -1; 679 return -1;
701 if (pcie_enable_notification(ctrl)) { 680 pcie_enable_notification(ctrl);
702 pciehp_free_irq(ctrl);
703 return -1;
704 }
705 ctrl->notification_enabled = 1; 681 ctrl->notification_enabled = 1;
706 return 0; 682 return 0;
707} 683}
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index 0e0d0f7f63fd..198355112ee7 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -78,7 +78,7 @@ int pciehp_configure_device(struct slot *p_slot)
78 78
79int pciehp_unconfigure_device(struct slot *p_slot) 79int pciehp_unconfigure_device(struct slot *p_slot)
80{ 80{
81 int ret, rc = 0; 81 int rc = 0;
82 u8 bctl = 0; 82 u8 bctl = 0;
83 u8 presence = 0; 83 u8 presence = 0;
84 struct pci_dev *dev, *temp; 84 struct pci_dev *dev, *temp;
@@ -88,9 +88,7 @@ int pciehp_unconfigure_device(struct slot *p_slot)
88 88
89 ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n", 89 ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n",
90 __func__, pci_domain_nr(parent), parent->number); 90 __func__, pci_domain_nr(parent), parent->number);
91 ret = pciehp_get_adapter_status(p_slot, &presence); 91 pciehp_get_adapter_status(p_slot, &presence);
92 if (ret)
93 presence = 0;
94 92
95 /* 93 /*
96 * Stopping an SR-IOV PF device removes all the associated VFs, 94 * Stopping an SR-IOV PF device removes all the associated VFs,