[PATCH 7/11] portdrv: enable device before irq initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>

---
 drivers/pci/pcie/portdrv_core.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Index: 20091125/drivers/pci/pcie/portdrv_core.c
===================================================================
--- 20091125.orig/drivers/pci/pcie/portdrv_core.c
+++ 20091125/drivers/pci/pcie/portdrv_core.c
@@ -302,6 +302,12 @@ int pcie_port_device_register(struct pci
 	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
 	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
 			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;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux