Thread (7 messages) flat view 7 messages, 3 authors, 2017-02-03
STALE3514d

[PATCH 1 3/4] PCI: layerscape: Use of_device_get_match_data() to simplify probe

From: Bjorn Helgaas <bhelgaas@google.com>
Date: 2017-01-31 20:20:13
Also in: linux-arm-kernel, linux-pci, linux-renesas-soc
Subsystem: pci subsystem, the rest · Maintainers: Bjorn Helgaas, Linus Torvalds

The only way to call ls_pcie_probe() is to match an entry in
ls_pcie_of_match[], so match cannot be NULL.

Use of_device_get_match_data() to retrieve the drvdata pointer.  No
functional change intended.

Based-on-suggestion-from: Geert Uytterhoeven [off-list ref]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pci-layerscape.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c
index ea789138531b..c1f06f8f05fd 100644
--- a/drivers/pci/host/pci-layerscape.c
+++ b/drivers/pci/host/pci-layerscape.c
@@ -239,23 +239,18 @@ static int __init ls_add_pcie_port(struct ls_pcie *pcie)
 static int __init ls_pcie_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	const struct of_device_id *match;
 	struct ls_pcie *pcie;
 	struct pcie_port *pp;
 	struct resource *dbi_base;
 	int ret;
 
-	match = of_match_device(ls_pcie_of_match, dev);
-	if (!match)
-		return -ENODEV;
-
 	pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
 	if (!pcie)
 		return -ENOMEM;
 
 	pp = &pcie->pp;
 	pp->dev = dev;
-	pcie->drvdata = match->data;
+	pcie->drvdata = of_device_get_match_data(dev);
 	pp->ops = pcie->drvdata->ops;
 
 	dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help