Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe89cf4c authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Greg Kroah-Hartman
Browse files

[PATCH] cpqphp: add pci_enable_device()

Add pci_{enable,disable}_device() calls.  Without pci_enable_device(),
dev->irq is garbage, and cpqphp relies on it.

This fixes a problem reported by Bruno Redondi.  He reported a flood
of ACPI interrupts, that caused kacpid to run 100% of the time:
    http://bugzilla.kernel.org/show_bug.cgi?id=5312



Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>

 drivers/pci/hotplug/cpqphp_core.c |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
parent c8920f0c
Loading
Loading
Loading
Loading
+19 −5
Original line number Original line Diff line number Diff line
@@ -794,12 +794,21 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	u32 rc;
	u32 rc;
	struct controller *ctrl;
	struct controller *ctrl;
	struct pci_func *func;
	struct pci_func *func;
	int err;

	err = pci_enable_device(pdev);
	if (err) {
		printk(KERN_ERR MY_NAME ": cannot enable PCI device %s (%d)\n",
			pci_name(pdev), err);
		return err;
	}


	// Need to read VID early b/c it's used to differentiate CPQ and INTC discovery
	// Need to read VID early b/c it's used to differentiate CPQ and INTC discovery
	rc = pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor_id);
	rc = pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor_id);
	if (rc || ((vendor_id != PCI_VENDOR_ID_COMPAQ) && (vendor_id != PCI_VENDOR_ID_INTEL))) {
	if (rc || ((vendor_id != PCI_VENDOR_ID_COMPAQ) && (vendor_id != PCI_VENDOR_ID_INTEL))) {
		err(msg_HPC_non_compaq_or_intel);
		err(msg_HPC_non_compaq_or_intel);
		return -ENODEV;
		rc = -ENODEV;
		goto err_disable_device;
	}
	}
	dbg("Vendor ID: %x\n", vendor_id);
	dbg("Vendor ID: %x\n", vendor_id);


@@ -807,7 +816,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	dbg("revision: %d\n", rev);
	dbg("revision: %d\n", rev);
	if (rc || ((vendor_id == PCI_VENDOR_ID_COMPAQ) && (!rev))) {
	if (rc || ((vendor_id == PCI_VENDOR_ID_COMPAQ) && (!rev))) {
		err(msg_HPC_rev_error);
		err(msg_HPC_rev_error);
		return -ENODEV;
		rc = -ENODEV;
		goto err_disable_device;
	}
	}


	/* Check for the proper subsytem ID's
	/* Check for the proper subsytem ID's
@@ -820,18 +830,20 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
		rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid);
		rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid);
		if (rc) {
		if (rc) {
			err("%s : pci_read_config_word failed\n", __FUNCTION__);
			err("%s : pci_read_config_word failed\n", __FUNCTION__);
			return rc;
			goto err_disable_device;
		}
		}
		dbg("Subsystem Vendor ID: %x\n", subsystem_vid);
		dbg("Subsystem Vendor ID: %x\n", subsystem_vid);
		if ((subsystem_vid != PCI_VENDOR_ID_COMPAQ) && (subsystem_vid != PCI_VENDOR_ID_INTEL)) {
		if ((subsystem_vid != PCI_VENDOR_ID_COMPAQ) && (subsystem_vid != PCI_VENDOR_ID_INTEL)) {
			err(msg_HPC_non_compaq_or_intel);
			err(msg_HPC_non_compaq_or_intel);
			return -ENODEV;
			rc = -ENODEV;
			goto err_disable_device;
		}
		}


		ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);
		ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);
		if (!ctrl) {
		if (!ctrl) {
			err("%s : out of memory\n", __FUNCTION__);
			err("%s : out of memory\n", __FUNCTION__);
			return -ENOMEM;
			rc = -ENOMEM;
			goto err_disable_device;
		}
		}
		memset(ctrl, 0, sizeof(struct controller));
		memset(ctrl, 0, sizeof(struct controller));


@@ -1264,6 +1276,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	kfree(ctrl->pci_bus);
	kfree(ctrl->pci_bus);
err_free_ctrl:
err_free_ctrl:
	kfree(ctrl);
	kfree(ctrl);
err_disable_device:
	pci_disable_device(pdev);
	return rc;
	return rc;
}
}