diff mbox

[8/9] PCI: xilinx-nwl: Add local struct device pointers

Message ID 20161007162944.24137.44119.stgit@bhelgaas-glaptop2.roam.corp.google.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Bjorn Helgaas Oct. 7, 2016, 4:29 p.m. UTC
Use a local "struct device *dev" for brevity and consistency with other
drivers.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-xilinx-nwl.c |  108 ++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 54 deletions(-)


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

Patch

diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
index 2403865..63b6174 100644
--- a/drivers/pci/host/pcie-xilinx-nwl.c
+++ b/drivers/pci/host/pcie-xilinx-nwl.c
@@ -277,6 +277,7 @@  static struct pci_ops nwl_pcie_ops = {
 static irqreturn_t nwl_pcie_misc_handler(int irq, void *data)
 {
 	struct nwl_pcie *nwl = data;
+	struct device *dev = nwl->dev;
 	u32 misc_stat;
 
 	/* Checking for misc interrupts */
@@ -286,45 +287,43 @@  static irqreturn_t nwl_pcie_misc_handler(int irq, void *data)
 		return IRQ_NONE;
 
 	if (misc_stat & MSGF_MISC_SR_RXMSG_OVER)
-		dev_err(nwl->dev, "Received Message FIFO Overflow\n");
+		dev_err(dev, "Received Message FIFO Overflow\n");
 
 	if (misc_stat & MSGF_MISC_SR_SLAVE_ERR)
-		dev_err(nwl->dev, "Slave error\n");
+		dev_err(dev, "Slave error\n");
 
 	if (misc_stat & MSGF_MISC_SR_MASTER_ERR)
-		dev_err(nwl->dev, "Master error\n");
+		dev_err(dev, "Master error\n");
 
 	if (misc_stat & MSGF_MISC_SR_I_ADDR_ERR)
-		dev_err(nwl->dev,
-			"In Misc Ingress address translation error\n");
+		dev_err(dev, "In Misc Ingress address translation error\n");
 
 	if (misc_stat & MSGF_MISC_SR_E_ADDR_ERR)
-		dev_err(nwl->dev,
-			"In Misc Egress address translation error\n");
+		dev_err(dev, "In Misc Egress address translation error\n");
 
 	if (misc_stat & MSGF_MISC_SR_FATAL_AER)
-		dev_err(nwl->dev, "Fatal Error in AER Capability\n");
+		dev_err(dev, "Fatal Error in AER Capability\n");
 
 	if (misc_stat & MSGF_MISC_SR_NON_FATAL_AER)
-		dev_err(nwl->dev, "Non-Fatal Error in AER Capability\n");
+		dev_err(dev, "Non-Fatal Error in AER Capability\n");
 
 	if (misc_stat & MSGF_MISC_SR_CORR_AER)
-		dev_err(nwl->dev, "Correctable Error in AER Capability\n");
+		dev_err(dev, "Correctable Error in AER Capability\n");
 
 	if (misc_stat & MSGF_MISC_SR_UR_DETECT)
-		dev_err(nwl->dev, "Unsupported request Detected\n");
+		dev_err(dev, "Unsupported request Detected\n");
 
 	if (misc_stat & MSGF_MISC_SR_NON_FATAL_DEV)
-		dev_err(nwl->dev, "Non-Fatal Error Detected\n");
+		dev_err(dev, "Non-Fatal Error Detected\n");
 
 	if (misc_stat & MSGF_MISC_SR_FATAL_DEV)
-		dev_err(nwl->dev, "Fatal Error Detected\n");
+		dev_err(dev, "Fatal Error Detected\n");
 
 	if (misc_stat & MSGF_MSIC_SR_LINK_AUTO_BWIDTH)
-		dev_info(nwl->dev, "Link Autonomous Bandwidth Management Status bit set\n");
+		dev_info(dev, "Link Autonomous Bandwidth Management Status bit set\n");
 
 	if (misc_stat & MSGF_MSIC_SR_LINK_BWIDTH)
-		dev_info(nwl->dev, "Link Bandwidth Management Status bit set\n");
+		dev_info(dev, "Link Bandwidth Management Status bit set\n");
 
 	/* Clear misc interrupt status */
 	nwl_bridge_writel(nwl, MSGF_MISC_STATUS, misc_stat);
@@ -494,20 +493,21 @@  static const struct irq_domain_ops dev_msi_domain_ops = {
 static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *nwl)
 {
 #ifdef CONFIG_PCI_MSI
-	struct fwnode_handle *fwnode = of_node_to_fwnode(nwl->dev->of_node);
+	struct device *dev = nwl->dev;
+	struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node);
 	struct nwl_msi *msi = &nwl->msi;
 
 	msi->dev_domain = irq_domain_add_linear(NULL, INT_PCI_MSI_NR,
 						&dev_msi_domain_ops, nwl);
 	if (!msi->dev_domain) {
-		dev_err(nwl->dev, "failed to create dev IRQ domain\n");
+		dev_err(dev, "failed to create dev IRQ domain\n");
 		return -ENOMEM;
 	}
 	msi->msi_domain = pci_msi_create_irq_domain(fwnode,
 						    &nwl_msi_domain_info,
 						    msi->dev_domain);
 	if (!msi->msi_domain) {
-		dev_err(nwl->dev, "failed to create msi IRQ domain\n");
+		dev_err(dev, "failed to create msi IRQ domain\n");
 		irq_domain_remove(msi->dev_domain);
 		return -ENOMEM;
 	}
@@ -517,12 +517,13 @@  static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *nwl)
 
 static int nwl_pcie_init_irq_domain(struct nwl_pcie *nwl)
 {
-	struct device_node *node = nwl->dev->of_node;
+	struct device *dev = nwl->dev;
+	struct device_node *node = dev->of_node;
 	struct device_node *legacy_intc_node;
 
 	legacy_intc_node = of_get_next_child(node, NULL);
 	if (!legacy_intc_node) {
-		dev_err(nwl->dev, "No legacy intc node found\n");
+		dev_err(dev, "No legacy intc node found\n");
 		return -EINVAL;
 	}
 
@@ -532,7 +533,7 @@  static int nwl_pcie_init_irq_domain(struct nwl_pcie *nwl)
 							nwl);
 
 	if (!nwl->legacy_irq_domain) {
-		dev_err(nwl->dev, "failed to create IRQ domain\n");
+		dev_err(dev, "failed to create IRQ domain\n");
 		return -ENOMEM;
 	}
 
@@ -542,7 +543,8 @@  static int nwl_pcie_init_irq_domain(struct nwl_pcie *nwl)
 
 static int nwl_pcie_enable_msi(struct nwl_pcie *nwl, struct pci_bus *bus)
 {
-	struct platform_device *pdev = to_platform_device(nwl->dev);
+	struct device *dev = nwl->dev;
+	struct platform_device *pdev = to_platform_device(dev);
 	struct nwl_msi *msi = &nwl->msi;
 	unsigned long base;
 	int ret;
@@ -557,7 +559,7 @@  static int nwl_pcie_enable_msi(struct nwl_pcie *nwl, struct pci_bus *bus)
 	/* Get msi_1 IRQ number */
 	msi->irq_msi1 = platform_get_irq_byname(pdev, "msi1");
 	if (msi->irq_msi1 < 0) {
-		dev_err(&pdev->dev, "failed to get IRQ#%d\n", msi->irq_msi1);
+		dev_err(dev, "failed to get IRQ#%d\n", msi->irq_msi1);
 		ret = -EINVAL;
 		goto err;
 	}
@@ -568,7 +570,7 @@  static int nwl_pcie_enable_msi(struct nwl_pcie *nwl, struct pci_bus *bus)
 	/* Get msi_0 IRQ number */
 	msi->irq_msi0 = platform_get_irq_byname(pdev, "msi0");
 	if (msi->irq_msi0 < 0) {
-		dev_err(&pdev->dev, "failed to get IRQ#%d\n", msi->irq_msi0);
+		dev_err(dev, "failed to get IRQ#%d\n", msi->irq_msi0);
 		ret = -EINVAL;
 		goto err;
 	}
@@ -579,7 +581,7 @@  static int nwl_pcie_enable_msi(struct nwl_pcie *nwl, struct pci_bus *bus)
 	/* Check for msii_present bit */
 	ret = nwl_bridge_readl(nwl, I_MSII_CAPABILITIES) & MSII_PRESENT;
 	if (!ret) {
-		dev_err(nwl->dev, "MSI not present\n");
+		dev_err(dev, "MSI not present\n");
 		ret = -EIO;
 		goto err;
 	}
@@ -631,13 +633,14 @@  err:
 
 static int nwl_pcie_bridge_init(struct nwl_pcie *nwl)
 {
-	struct platform_device *pdev = to_platform_device(nwl->dev);
+	struct device *dev = nwl->dev;
+	struct platform_device *pdev = to_platform_device(dev);
 	u32 breg_val, ecam_val, first_busno = 0;
 	int err;
 
 	breg_val = nwl_bridge_readl(nwl, E_BREG_CAPABILITIES) & BREG_PRESENT;
 	if (!breg_val) {
-		dev_err(nwl->dev, "BREG is not present\n");
+		dev_err(dev, "BREG is not present\n");
 		return breg_val;
 	}
 
@@ -669,7 +672,7 @@  static int nwl_pcie_bridge_init(struct nwl_pcie *nwl)
 
 	ecam_val = nwl_bridge_readl(nwl, E_ECAM_CAPABILITIES) & E_ECAM_PRESENT;
 	if (!ecam_val) {
-		dev_err(nwl->dev, "ECAM is not present\n");
+		dev_err(dev, "ECAM is not present\n");
 		return ecam_val;
 	}
 
@@ -697,24 +700,22 @@  static int nwl_pcie_bridge_init(struct nwl_pcie *nwl)
 	writel(ecam_val, (nwl->ecam_base + PCI_PRIMARY_BUS));
 
 	if (nwl_pcie_link_up(nwl))
-		dev_info(nwl->dev, "Link is UP\n");
+		dev_info(dev, "Link is UP\n");
 	else
-		dev_info(nwl->dev, "Link is DOWN\n");
+		dev_info(dev, "Link is DOWN\n");
 
 	/* Get misc IRQ number */
 	nwl->irq_misc = platform_get_irq_byname(pdev, "misc");
 	if (nwl->irq_misc < 0) {
-		dev_err(&pdev->dev, "failed to get misc IRQ %d\n",
-			nwl->irq_misc);
+		dev_err(dev, "failed to get misc IRQ %d\n", nwl->irq_misc);
 		return -EINVAL;
 	}
 
-	err = devm_request_irq(nwl->dev, nwl->irq_misc,
+	err = devm_request_irq(dev, nwl->irq_misc,
 			       nwl_pcie_misc_handler, IRQF_SHARED,
 			       "nwl_pcie:misc", nwl);
 	if (err) {
-		dev_err(nwl->dev, "fail to register misc IRQ#%d\n",
-			nwl->irq_misc);
+		dev_err(dev, "fail to register misc IRQ#%d\n", nwl->irq_misc);
 		return err;
 	}
 
@@ -751,31 +752,32 @@  static int nwl_pcie_bridge_init(struct nwl_pcie *nwl)
 static int nwl_pcie_parse_dt(struct nwl_pcie *nwl,
 			     struct platform_device *pdev)
 {
-	struct device_node *node = nwl->dev->of_node;
+	struct device *dev = nwl->dev;
+	struct device_node *node = dev->of_node;
 	struct resource *res;
 	const char *type;
 
 	/* Check for device type */
 	type = of_get_property(node, "device_type", NULL);
 	if (!type || strcmp(type, "pci")) {
-		dev_err(nwl->dev, "invalid \"device_type\" %s\n", type);
+		dev_err(dev, "invalid \"device_type\" %s\n", type);
 		return -EINVAL;
 	}
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
-	nwl->breg_base = devm_ioremap_resource(nwl->dev, res);
+	nwl->breg_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(nwl->breg_base))
 		return PTR_ERR(nwl->breg_base);
 	nwl->phys_breg_base = res->start;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcireg");
-	nwl->pcireg_base = devm_ioremap_resource(nwl->dev, res);
+	nwl->pcireg_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(nwl->pcireg_base))
 		return PTR_ERR(nwl->pcireg_base);
 	nwl->phys_pcie_reg_base = res->start;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
-	nwl->ecam_base = devm_ioremap_resource(nwl->dev, res);
+	nwl->ecam_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(nwl->ecam_base))
 		return PTR_ERR(nwl->ecam_base);
 	nwl->phys_ecam_base = res->start;
@@ -783,14 +785,12 @@  static int nwl_pcie_parse_dt(struct nwl_pcie *nwl,
 	/* Get intx IRQ number */
 	nwl->irq_intx = platform_get_irq_byname(pdev, "intx");
 	if (nwl->irq_intx < 0) {
-		dev_err(&pdev->dev, "failed to get intx IRQ %d\n",
-			nwl->irq_intx);
+		dev_err(dev, "failed to get intx IRQ %d\n", nwl->irq_intx);
 		return -EINVAL;
 	}
 
 	irq_set_chained_handler_and_data(nwl->irq_intx,
 					 nwl_pcie_leg_handler, nwl);
-
 	return 0;
 }
 
@@ -801,7 +801,8 @@  static const struct of_device_id nwl_pcie_of_match[] = {
 
 static int nwl_pcie_probe(struct platform_device *pdev)
 {
-	struct device_node *node = pdev->dev.of_node;
+	struct device *dev = &pdev->dev;
+	struct device_node *node = dev->of_node;
 	struct nwl_pcie *nwl;
 	struct pci_bus *bus;
 	struct pci_bus *child;
@@ -809,42 +810,42 @@  static int nwl_pcie_probe(struct platform_device *pdev)
 	resource_size_t iobase = 0;
 	LIST_HEAD(res);
 
-	nwl = devm_kzalloc(&pdev->dev, sizeof(*nwl), GFP_KERNEL);
+	nwl = devm_kzalloc(dev, sizeof(*nwl), GFP_KERNEL);
 	if (!nwl)
 		return -ENOMEM;
 
-	nwl->dev = &pdev->dev;
+	nwl->dev = dev;
 	nwl->ecam_value = NWL_ECAM_VALUE_DEFAULT;
 
 	err = nwl_pcie_parse_dt(nwl, pdev);
 	if (err) {
-		dev_err(nwl->dev, "Parsing DT failed\n");
+		dev_err(dev, "Parsing DT failed\n");
 		return err;
 	}
 
 	err = nwl_pcie_bridge_init(nwl);
 	if (err) {
-		dev_err(nwl->dev, "HW Initialization failed\n");
+		dev_err(dev, "HW Initialization failed\n");
 		return err;
 	}
 
 	err = of_pci_get_host_bridge_resources(node, 0, 0xff, &res, &iobase);
 	if (err) {
-		dev_err(nwl->dev, "Getting bridge resources failed\n");
+		dev_err(dev, "Getting bridge resources failed\n");
 		return err;
 	}
 
-	err = devm_request_pci_bus_resources(nwl->dev, &res);
+	err = devm_request_pci_bus_resources(dev, &res);
 	if (err)
 		goto error;
 
 	err = nwl_pcie_init_irq_domain(nwl);
 	if (err) {
-		dev_err(nwl->dev, "Failed creating IRQ Domain\n");
+		dev_err(dev, "Failed creating IRQ Domain\n");
 		goto error;
 	}
 
-	bus = pci_create_root_bus(&pdev->dev, nwl->root_busno,
+	bus = pci_create_root_bus(dev, nwl->root_busno,
 				  &nwl_pcie_ops, nwl, &res);
 	if (!bus) {
 		err = -ENOMEM;
@@ -854,8 +855,7 @@  static int nwl_pcie_probe(struct platform_device *pdev)
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		err = nwl_pcie_enable_msi(nwl, bus);
 		if (err < 0) {
-			dev_err(&pdev->dev,
-				"failed to enable MSI support: %d\n", err);
+			dev_err(dev, "failed to enable MSI support: %d\n", err);
 			goto error;
 		}
 	}