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>
This commit is contained in:
Kenji Kaneshige 2009-11-25 21:04:30 +09:00 committed by Jesse Barnes
parent dc5351784e
commit 1ce5e83063
1 changed files with 11 additions and 10 deletions

View File

@ -302,6 +302,12 @@ int pcie_port_device_register(struct pci_dev *dev)
port_data->port_type = dev->pcie_type; port_data->port_type = dev->pcie_type;
pci_set_drvdata(dev, port_data); 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 * Initialize service irqs. Don't use service devices that
* require interrupts if there is no way to generate them. * 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) { if (status) {
capabilities &= PCIE_PORT_SERVICE_VC; capabilities &= PCIE_PORT_SERVICE_VC;
if (!capabilities) 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 */ /* Allocate child services if any */
for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
int service = 1 << i; int service = 1 << i;
@ -330,14 +331,14 @@ int pcie_port_device_register(struct pci_dev *dev)
nr_serv++; nr_serv++;
} }
if (!nr_serv) { if (!nr_serv) {
pci_disable_device(dev);
status = -ENODEV; status = -ENODEV;
goto Error; goto error_disable;
} }
return 0; return 0;
Error: error_disable:
pci_disable_device(dev);
error_kfree:
kfree(port_data); kfree(port_data);
return status; return status;
} }