diff mbox series

[09/13] PCI: ftpci100: Replace device * with platform_device *

Message ID 0d49eb261d6cd7a69c98280a50f9db90e2e8fd75.1638022049.git.ffclaire1224@gmail.com (mailing list archive)
State Rejected
Delegated to: Lorenzo Pieralisi
Headers show
Series Unify device * to platform_device * | expand

Commit Message

Fan Fei Nov. 27, 2021, 2:11 p.m. UTC
Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct faraday_pci, because PCI controllers interact with platform_device
directly, not device, to enumerate the controlled device.

Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
---
 drivers/pci/controller/pci-ftpci100.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c
index 88980a44461d..64e4405ad0be 100644
--- a/drivers/pci/controller/pci-ftpci100.c
+++ b/drivers/pci/controller/pci-ftpci100.c
@@ -120,7 +120,7 @@  struct faraday_pci_variant {
 };
 
 struct faraday_pci {
-	struct device *dev;
+	struct platform_device *pdev;
 	void __iomem *base;
 	struct irq_domain *irqdomain;
 	struct pci_bus *bus;
@@ -342,19 +342,20 @@  static const struct irq_domain_ops faraday_pci_irqdomain_ops = {
 
 static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
 {
-	struct device_node *intc = of_get_next_child(p->dev->of_node, NULL);
+	struct device *dev = &p->pdev->dev;
+	struct device_node *intc = of_get_next_child(dev->of_node, NULL);
 	int irq;
 	int i;
 
 	if (!intc) {
-		dev_err(p->dev, "missing child interrupt-controller node\n");
+		dev_err(dev, "missing child interrupt-controller node\n");
 		return -EINVAL;
 	}
 
 	/* All PCI IRQs cascade off this one */
 	irq = of_irq_get(intc, 0);
 	if (irq <= 0) {
-		dev_err(p->dev, "failed to get parent IRQ\n");
+		dev_err(dev, "failed to get parent IRQ\n");
 		of_node_put(intc);
 		return irq ?: -EINVAL;
 	}
@@ -363,7 +364,7 @@  static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
 					     &faraday_pci_irqdomain_ops, p);
 	of_node_put(intc);
 	if (!p->irqdomain) {
-		dev_err(p->dev, "failed to create Gemini PCI IRQ domain\n");
+		dev_err(dev, "failed to create Gemini PCI IRQ domain\n");
 		return -EINVAL;
 	}
 
@@ -377,7 +378,7 @@  static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p)
 
 static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p)
 {
-	struct device *dev = p->dev;
+	struct device *dev = &p->pdev->dev;
 	struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p);
 	struct resource_entry *entry;
 	u32 confreg[3] = {
@@ -439,7 +440,7 @@  static int faraday_pci_probe(struct platform_device *pdev)
 	host->ops = &faraday_pci_ops;
 	p = pci_host_bridge_priv(host);
 	host->sysdata = p;
-	p->dev = dev;
+	p->pdev = pdev;
 
 	/* Retrieve and enable optional clocks */
 	clk = devm_clk_get(dev, "PCLK");