diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-11-25 07:04:30 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-12-04 18:55:59 -0500 |
commit | 1ce5e83063bf388a2c9fa1e3d4d3122146ad305d (patch) | |
tree | 10528a2c8dd991a7c6ad6e55058469d96aa335d5 /drivers/pci/pcie | |
parent | dc5351784eb36f1fec4efa88e01581be72c0b711 (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/pcie')
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 21 |
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) | |||
302 | port_data->port_type = dev->pcie_type; | 302 | port_data->port_type = dev->pcie_type; |
303 | pci_set_drvdata(dev, port_data); | 303 | pci_set_drvdata(dev, port_data); |
304 | 304 | ||
305 | /* Enable PCI Express port device */ | ||
306 | status = pci_enable_device(dev); | ||
307 | if (status) | ||
308 | goto error_kfree; | ||
309 | pci_set_master(dev); | ||
310 | |||
305 | /* | 311 | /* |
306 | * Initialize service irqs. Don't use service devices that | 312 | * Initialize service irqs. Don't use service devices that |
307 | * require interrupts if there is no way to generate them. | 313 | * require interrupts if there is no way to generate them. |
@@ -310,14 +316,9 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
310 | if (status) { | 316 | if (status) { |
311 | capabilities &= PCIE_PORT_SERVICE_VC; | 317 | capabilities &= PCIE_PORT_SERVICE_VC; |
312 | if (!capabilities) | 318 | if (!capabilities) |
313 | goto Error; | 319 | goto error_disable; |
314 | } | 320 | } |
315 | 321 | ||
316 | status = pci_enable_device(dev); | ||
317 | if (status) | ||
318 | goto Error; | ||
319 | pci_set_master(dev); | ||
320 | |||
321 | /* Allocate child services if any */ | 322 | /* Allocate child services if any */ |
322 | for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { | 323 | for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { |
323 | int service = 1 << i; | 324 | int service = 1 << i; |
@@ -330,14 +331,14 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
330 | nr_serv++; | 331 | nr_serv++; |
331 | } | 332 | } |
332 | if (!nr_serv) { | 333 | if (!nr_serv) { |
333 | pci_disable_device(dev); | ||
334 | status = -ENODEV; | 334 | status = -ENODEV; |
335 | goto Error; | 335 | goto error_disable; |
336 | } | 336 | } |
337 | |||
338 | return 0; | 337 | return 0; |
339 | 338 | ||
340 | Error: | 339 | error_disable: |
340 | pci_disable_device(dev); | ||
341 | error_kfree: | ||
341 | kfree(port_data); | 342 | kfree(port_data); |
342 | return status; | 343 | return status; |
343 | } | 344 | } |