summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-25 21:04:30 +0900
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-12-04 15:55:59 -0800
commit1ce5e83063bf388a2c9fa1e3d4d3122146ad305d (patch)
tree10528a2c8dd991a7c6ad6e55058469d96aa335d5 /drivers/pci
parentdc5351784eb36f1fec4efa88e01581be72c0b711 (diff)
PCI: portdrv: enable device before irq initialization
Call pci_enable_device() before initializing service irqs, because legacy interrupt is initialized in pci_enable_device() on some architectures. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/portdrv_core.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index d208dc2d62fd..a2ac618a95be 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -302,6 +302,12 @@ int pcie_port_device_register(struct pci_dev *dev)
port_data->port_type = dev->pcie_type;
pci_set_drvdata(dev, port_data);
+ /* Enable PCI Express port device */
+ status = pci_enable_device(dev);
+ if (status)
+ goto error_kfree;
+ pci_set_master(dev);
+
/*
* Initialize service irqs. Don't use service devices that
* require interrupts if there is no way to generate them.
@@ -310,14 +316,9 @@ int pcie_port_device_register(struct pci_dev *dev)
if (status) {
capabilities &= PCIE_PORT_SERVICE_VC;
if (!capabilities)
- goto Error;
+ goto error_disable;
}
- status = pci_enable_device(dev);
- if (status)
- goto Error;
- pci_set_master(dev);
-
/* Allocate child services if any */
for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
int service = 1 << i;
@@ -330,14 +331,14 @@ int pcie_port_device_register(struct pci_dev *dev)
nr_serv++;
}
if (!nr_serv) {
- pci_disable_device(dev);
status = -ENODEV;
- goto Error;
+ goto error_disable;
}
-
return 0;
- Error:
+error_disable:
+ pci_disable_device(dev);
+error_kfree:
kfree(port_data);
return status;
}