Commit e5c3b3e9 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: iproc: Use of_device_get_match_data() to simplify probe

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

Use of_device_get_match_data() to retrieve the pcie->type.  No functional
change intended.

Based-on-suggestion-from: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 7ce7d89f
...@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(of, iproc_pcie_of_match_table); ...@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(of, iproc_pcie_of_match_table);
static int iproc_pcie_pltfm_probe(struct platform_device *pdev) static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct of_device_id *of_id;
struct iproc_pcie *pcie; struct iproc_pcie *pcie;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct resource reg; struct resource reg;
...@@ -55,16 +54,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev) ...@@ -55,16 +54,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
LIST_HEAD(res); LIST_HEAD(res);
int ret; int ret;
of_id = of_match_device(iproc_pcie_of_match_table, dev);
if (!of_id)
return -EINVAL;
pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
if (!pcie) if (!pcie)
return -ENOMEM; return -ENOMEM;
pcie->dev = dev; pcie->dev = dev;
pcie->type = (enum iproc_pcie_type)of_id->data; pcie->type = (enum iproc_pcie_type) of_device_get_match_data(dev);
ret = of_address_to_resource(np, 0, &reg); ret = of_address_to_resource(np, 0, &reg);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment