Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139314
b: refs/heads/master
c: f118c0c
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Jesse Barnes committed Mar 20, 2009
1 parent dfb3e70 commit c6b9525
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90e9cd50f7feeddc911325c8a8c1b7e1fccc6599
refs/heads/master: f118c0c3cff4fed39bde1863f9d59850719645cc
38 changes: 28 additions & 10 deletions trunk/drivers/pci/pcie/portdrv_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int pcie_port_device_probe(struct pci_dev *dev)
int pcie_port_device_register(struct pci_dev *dev)
{
struct pcie_port_data *port_data;
int status, capabilities, irq_mode, i;
int status, capabilities, irq_mode, i, nr_serv;
int vectors[PCIE_PORT_DEVICE_MAXSERVICES];
u16 reg16;

Expand All @@ -229,24 +229,32 @@ int pcie_port_device_register(struct pci_dev *dev)
capabilities |= PCIE_PORT_SERVICE_PME;

irq_mode = assign_interrupt_mode(dev, vectors, capabilities);
if (irq_mode == PCIE_PORT_NO_IRQ) {
/*
* Don't use service devices that require interrupts if there is
* no way to generate them.
*/
if (!(capabilities & PCIE_PORT_SERVICE_VC)) {
status = -ENODEV;
goto Error;
}
capabilities = PCIE_PORT_SERVICE_VC;
}
port_data->port_irq_mode = irq_mode;

status = pci_enable_device(dev);
if (status)
goto Error;
pci_set_master(dev);

/* Allocate child services if any */
for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
for (i = 0, nr_serv = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
struct pcie_device *child;
int service = 1 << i;

if (!(capabilities & service))
continue;

/*
* Don't use service devices that require interrupts if there is
* no way to generate them.
*/
if (irq_mode == PCIE_PORT_NO_IRQ
&& service != PCIE_PORT_SERVICE_VC)
continue;

child = alloc_pcie_device(dev, service, vectors[i]);
if (!child)
continue;
Expand All @@ -258,9 +266,19 @@ int pcie_port_device_register(struct pci_dev *dev)
}

get_device(&child->device);
nr_serv++;
}
if (!nr_serv) {
pci_disable_device(dev);
status = -ENODEV;
goto Error;
}

return 0;

Error:
kfree(port_data);
return status;
}

#ifdef CONFIG_PM
Expand Down
11 changes: 3 additions & 8 deletions trunk/drivers/pci/pcie/portdrv_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,13 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
if (status)
return status;

if (pci_enable_device(dev) < 0)
return -ENODEV;

pci_set_master(dev);
if (!dev->irq && dev->pin) {
dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; "
"check vendor BIOS\n", dev->vendor, dev->device);
}
if (pcie_port_device_register(dev)) {
pci_disable_device(dev);
return -ENOMEM;
}
status = pcie_port_device_register(dev);
if (status)
return status;

pcie_portdrv_save_config(dev);

Expand Down

0 comments on commit c6b9525

Please sign in to comment.