aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-06-22 22:11:56 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-22 22:11:56 -0400
commit71d530cd1b6d97094481002a04c77fea1c8e1c22 (patch)
treee786da7145d83c19a594adf76ed90d52c51058b1 /drivers/pci/hotplug/pciehp_hpc.c
parentd7a80dad2fe19a2b8c119c8e9cba605474a75a2b (diff)
parentd588fcbe5a7ba8bba2cebf7799ab2d573717a806 (diff)
Merge branch 'master' into upstream
Conflicts: drivers/scsi/libata-core.c drivers/scsi/libata-scsi.c include/linux/pci_ids.h
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 6c14d9e46b2..d77138ecb09 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1288,7 +1288,7 @@ int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
1288 if (ACPI_SUCCESS(status)) { 1288 if (ACPI_SUCCESS(status)) {
1289 dbg("Gained control for hotplug HW for pci %s (%s)\n", 1289 dbg("Gained control for hotplug HW for pci %s (%s)\n",
1290 pci_name(dev), (char *)string.pointer); 1290 pci_name(dev), (char *)string.pointer);
1291 acpi_os_free(string.pointer); 1291 kfree(string.pointer);
1292 return 0; 1292 return 0;
1293 } 1293 }
1294 if (acpi_root_bridge(handle)) 1294 if (acpi_root_bridge(handle))
@@ -1302,7 +1302,7 @@ int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
1302 err("Cannot get control of hotplug hardware for pci %s\n", 1302 err("Cannot get control of hotplug hardware for pci %s\n",
1303 pci_name(dev)); 1303 pci_name(dev));
1304 1304
1305 acpi_os_free(string.pointer); 1305 kfree(string.pointer);
1306 return -1; 1306 return -1;
1307} 1307}
1308#endif 1308#endif
@@ -1404,9 +1404,6 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1404 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, 1404 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device,
1405 pdev->subsystem_vendor, pdev->subsystem_device); 1405 pdev->subsystem_vendor, pdev->subsystem_device);
1406 1406
1407 if (pci_enable_device(pdev))
1408 goto abort_free_ctlr;
1409
1410 mutex_init(&ctrl->crit_sect); 1407 mutex_init(&ctrl->crit_sect);
1411 /* setup wait queue */ 1408 /* setup wait queue */
1412 init_waitqueue_head(&ctrl->queue); 1409 init_waitqueue_head(&ctrl->queue);
@@ -1474,7 +1471,7 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1474 rc = hp_register_read_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word); 1471 rc = hp_register_read_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word);
1475 if (rc) { 1472 if (rc) {
1476 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__); 1473 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__);
1477 goto abort_free_ctlr; 1474 goto abort_free_irq;
1478 } 1475 }
1479 1476
1480 intr_enable = intr_enable | PRSN_DETECT_ENABLE; 1477 intr_enable = intr_enable | PRSN_DETECT_ENABLE;
@@ -1500,19 +1497,19 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1500 rc = hp_register_write_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word); 1497 rc = hp_register_write_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word);
1501 if (rc) { 1498 if (rc) {
1502 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__); 1499 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__);
1503 goto abort_free_ctlr; 1500 goto abort_free_irq;
1504 } 1501 }
1505 rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status); 1502 rc = hp_register_read_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), slot_status);
1506 if (rc) { 1503 if (rc) {
1507 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__); 1504 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__);
1508 goto abort_free_ctlr; 1505 goto abort_disable_intr;
1509 } 1506 }
1510 1507
1511 temp_word = 0x1F; /* Clear all events */ 1508 temp_word = 0x1F; /* Clear all events */
1512 rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), temp_word); 1509 rc = hp_register_write_word(php_ctlr->pci_dev, SLOT_STATUS(ctrl->cap_base), temp_word);
1513 if (rc) { 1510 if (rc) {
1514 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__); 1511 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__);
1515 goto abort_free_ctlr; 1512 goto abort_disable_intr;
1516 } 1513 }
1517 1514
1518 if (pciehp_force) { 1515 if (pciehp_force) {
@@ -1521,7 +1518,7 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1521 } else { 1518 } else {
1522 rc = pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev); 1519 rc = pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev);
1523 if (rc) 1520 if (rc)
1524 goto abort_free_ctlr; 1521 goto abort_disable_intr;
1525 } 1522 }
1526 1523
1527 /* Add this HPC instance into the HPC list */ 1524 /* Add this HPC instance into the HPC list */
@@ -1548,6 +1545,21 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1548 return 0; 1545 return 0;
1549 1546
1550 /* We end up here for the many possible ways to fail this API. */ 1547 /* We end up here for the many possible ways to fail this API. */
1548abort_disable_intr:
1549 rc = hp_register_read_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word);
1550 if (!rc) {
1551 temp_word &= ~(intr_enable | HP_INTR_ENABLE);
1552 rc = hp_register_write_word(pdev, SLOT_CTRL(ctrl->cap_base), temp_word);
1553 }
1554 if (rc)
1555 err("%s : disabling interrupts failed\n", __FUNCTION__);
1556
1557abort_free_irq:
1558 if (pciehp_poll_mode)
1559 del_timer_sync(&php_ctlr->int_poll_timer);
1560 else
1561 free_irq(php_ctlr->irq, ctrl);
1562
1551abort_free_ctlr: 1563abort_free_ctlr:
1552 pcie_cap_base = saved_cap_base; 1564 pcie_cap_base = saved_cap_base;
1553 kfree(php_ctlr); 1565 kfree(php_ctlr);