aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShailendra Verma <shailendra.v@samsung.com>2017-01-31 15:00:48 -0500
committerBjorn Helgaas <bhelgaas@google.com>2017-02-03 16:01:14 -0500
commit792e0a6814b63b120c6cfddf79a309046c6e840a (patch)
tree50e8b8cf79d0ae37d89c9a45f2e5629a2f11f8cf
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
PCI: hisi: Use of_device_get_match_data() to simplify probe
The only way to call hisi_pcie_probe() is to match an entry in hisi_pcie_of_match[], so match cannot be NULL. Use of_device_get_match_data() to retrieve the soc_ops pointer. No functional change intended. [bhelgaas: use of_device_get_match_data(), changelog] Based-on-suggestion-from: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/host/pcie-hisi.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c
index a301a7187b30..33c201afdbf1 100644
--- a/drivers/pci/host/pcie-hisi.c
+++ b/drivers/pci/host/pcie-hisi.c
@@ -139,7 +139,7 @@ struct hisi_pcie {
139 struct pcie_port pp; /* pp.dbi_base is DT rc_dbi */ 139 struct pcie_port pp; /* pp.dbi_base is DT rc_dbi */
140 struct regmap *subctrl; 140 struct regmap *subctrl;
141 u32 port_id; 141 u32 port_id;
142 struct pcie_soc_ops *soc_ops; 142 const struct pcie_soc_ops *soc_ops;
143}; 143};
144 144
145/* HipXX PCIe host only supports 32-bit config access */ 145/* HipXX PCIe host only supports 32-bit config access */
@@ -259,7 +259,6 @@ static int hisi_pcie_probe(struct platform_device *pdev)
259 struct device *dev = &pdev->dev; 259 struct device *dev = &pdev->dev;
260 struct hisi_pcie *hisi_pcie; 260 struct hisi_pcie *hisi_pcie;
261 struct pcie_port *pp; 261 struct pcie_port *pp;
262 const struct of_device_id *match;
263 struct resource *reg; 262 struct resource *reg;
264 struct device_driver *driver; 263 struct device_driver *driver;
265 int ret; 264 int ret;
@@ -272,11 +271,10 @@ static int hisi_pcie_probe(struct platform_device *pdev)
272 pp->dev = dev; 271 pp->dev = dev;
273 driver = dev->driver; 272 driver = dev->driver;
274 273
275 match = of_match_device(driver->of_match_table, dev); 274 hisi_pcie->soc_ops = of_device_get_match_data(dev);
276 hisi_pcie->soc_ops = (struct pcie_soc_ops *) match->data;
277 275
278 hisi_pcie->subctrl = 276 hisi_pcie->subctrl =
279 syscon_regmap_lookup_by_compatible("hisilicon,pcie-sas-subctrl"); 277 syscon_regmap_lookup_by_compatible("hisilicon,pcie-sas-subctrl");
280 if (IS_ERR(hisi_pcie->subctrl)) { 278 if (IS_ERR(hisi_pcie->subctrl)) {
281 dev_err(dev, "cannot get subctrl base\n"); 279 dev_err(dev, "cannot get subctrl base\n");
282 return PTR_ERR(hisi_pcie->subctrl); 280 return PTR_ERR(hisi_pcie->subctrl);