diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2017-01-31 17:36:32 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-01-31 17:36:32 -0500 |
commit | e5c3b3e9f012b8862753a04f03c6e27344332718 (patch) | |
tree | b1568a46d8a8ccda8098e4966873eee32b435e26 | |
parent | 7ce7d89f48834cefece7804d38fc5d85382edf77 (diff) |
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: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/host/pcie-iproc-platform.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c index 22d814a78a78..f4909bb0b2ad 100644 --- a/drivers/pci/host/pcie-iproc-platform.c +++ b/drivers/pci/host/pcie-iproc-platform.c | |||
@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(of, iproc_pcie_of_match_table); | |||
47 | static int iproc_pcie_pltfm_probe(struct platform_device *pdev) | 47 | static int iproc_pcie_pltfm_probe(struct platform_device *pdev) |
48 | { | 48 | { |
49 | struct device *dev = &pdev->dev; | 49 | struct device *dev = &pdev->dev; |
50 | const struct of_device_id *of_id; | ||
51 | struct iproc_pcie *pcie; | 50 | struct iproc_pcie *pcie; |
52 | struct device_node *np = dev->of_node; | 51 | struct device_node *np = dev->of_node; |
53 | struct resource reg; | 52 | struct resource reg; |
@@ -55,16 +54,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev) | |||
55 | LIST_HEAD(res); | 54 | LIST_HEAD(res); |
56 | int ret; | 55 | int ret; |
57 | 56 | ||
58 | of_id = of_match_device(iproc_pcie_of_match_table, dev); | ||
59 | if (!of_id) | ||
60 | return -EINVAL; | ||
61 | |||
62 | pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); | 57 | pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); |
63 | if (!pcie) | 58 | if (!pcie) |
64 | return -ENOMEM; | 59 | return -ENOMEM; |
65 | 60 | ||
66 | pcie->dev = dev; | 61 | pcie->dev = dev; |
67 | pcie->type = (enum iproc_pcie_type)of_id->data; | 62 | pcie->type = (enum iproc_pcie_type) of_device_get_match_data(dev); |
68 | 63 | ||
69 | ret = of_address_to_resource(np, 0, ®); | 64 | ret = of_address_to_resource(np, 0, ®); |
70 | if (ret < 0) { | 65 | if (ret < 0) { |