linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fan Fei <ffclaire1224@gmail.com>
To: bjorn@helgaas.com
Cc: Fan Fei <ffclaire1224@gmail.com>, linux-pci@vger.kernel.org
Subject: [PATCH 12/13] PCI: xilinx-nwl: Replace device * with platform_device *
Date: Sat, 27 Nov 2021 15:11:20 +0100	[thread overview]
Message-ID: <5e0d29625125ca307768749c055e76feb552b9c8.1638022049.git.ffclaire1224@gmail.com> (raw)
In-Reply-To: <cover.1638022048.git.ffclaire1224@gmail.com>

Some PCI controller struct contain "device *", while others contain
"platform_device *". Unify "device *dev" to "platform_device *pdev" in
struct nwl_pcie, 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/pcie-xilinx-nwl.c | 28 ++++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
index a72b4f9a2b00..2e17fe41a9bd 100644
--- a/drivers/pci/controller/pcie-xilinx-nwl.c
+++ b/drivers/pci/controller/pcie-xilinx-nwl.c
@@ -154,7 +154,7 @@ struct nwl_msi {			/* MSI information */
 };
 
 struct nwl_pcie {
-	struct device *dev;
+	struct platform_device *pdev;
 	void __iomem *breg_base;
 	void __iomem *pcireg_base;
 	void __iomem *ecam_base;
@@ -200,7 +200,7 @@ static bool nwl_phy_link_up(struct nwl_pcie *pcie)
 
 static int nwl_wait_for_link(struct nwl_pcie *pcie)
 {
-	struct device *dev = pcie->dev;
+	struct device *dev = &pcie->pdev->dev;
 	int retries;
 
 	/* check if the link is up or not */
@@ -260,7 +260,7 @@ static struct pci_ops nwl_pcie_ops = {
 static irqreturn_t nwl_pcie_misc_handler(int irq, void *data)
 {
 	struct nwl_pcie *pcie = data;
-	struct device *dev = pcie->dev;
+	struct device *dev = &pcie->pdev->dev;
 	u32 misc_stat;
 
 	/* Checking for misc interrupts */
@@ -504,7 +504,7 @@ static const struct irq_domain_ops dev_msi_domain_ops = {
 static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie)
 {
 #ifdef CONFIG_PCI_MSI
-	struct device *dev = pcie->dev;
+	struct device *dev = &pcie->pdev->dev;
 	struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node);
 	struct nwl_msi *msi = &pcie->msi;
 
@@ -528,7 +528,7 @@ static int nwl_pcie_init_msi_irq_domain(struct nwl_pcie *pcie)
 
 static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
 {
-	struct device *dev = pcie->dev;
+	struct device *dev = &pcie->pdev->dev;
 	struct device_node *node = dev->of_node;
 	struct device_node *legacy_intc_node;
 
@@ -555,8 +555,8 @@ static int nwl_pcie_init_irq_domain(struct nwl_pcie *pcie)
 
 static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
 {
-	struct device *dev = pcie->dev;
-	struct platform_device *pdev = to_platform_device(dev);
+	struct platform_device *pdev = pcie->pdev;
+	struct device *dev = &pdev->dev;
 	struct nwl_msi *msi = &pcie->msi;
 	unsigned long base;
 	int ret;
@@ -640,8 +640,8 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
 
 static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
 {
-	struct device *dev = pcie->dev;
-	struct platform_device *pdev = to_platform_device(dev);
+	struct platform_device *pdev = pcie->pdev;
+	struct device *dev = &pdev->dev;
 	u32 breg_val, ecam_val, first_busno = 0;
 	int err;
 
@@ -756,10 +756,10 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
 	return 0;
 }
 
-static int nwl_pcie_parse_dt(struct nwl_pcie *pcie,
-			     struct platform_device *pdev)
+static int nwl_pcie_parse_dt(struct nwl_pcie *pcie)
 {
-	struct device *dev = pcie->dev;
+	struct platform_device *pdev = pcie->pdev;
+	struct device *dev = &pdev->dev;
 	struct resource *res;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
@@ -809,10 +809,10 @@ static int nwl_pcie_probe(struct platform_device *pdev)
 
 	pcie = pci_host_bridge_priv(bridge);
 
-	pcie->dev = dev;
+	pcie->pdev = pdev;
 	pcie->ecam_value = NWL_ECAM_VALUE_DEFAULT;
 
-	err = nwl_pcie_parse_dt(pcie, pdev);
+	err = nwl_pcie_parse_dt(pcie);
 	if (err) {
 		dev_err(dev, "Parsing DT failed\n");
 		return err;
-- 
2.25.1


  parent reply	other threads:[~2021-11-27 14:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27 14:11 [PATCH 00/13] Unify device * to platform_device * Fan Fei
2021-11-27 14:11 ` [PATCH 01/13] PCI: xilinx: Replace device * with " Fan Fei
2021-11-27 14:11 ` [PATCH 02/13] PCI: mediatek: " Fan Fei
2021-11-27 14:11 ` [PATCH 03/13] PCI: tegra: " Fan Fei
2021-11-27 14:11 ` [PATCH 04/13] PCI: xegene: " Fan Fei
2021-11-27 14:11 ` [PATCH 05/13] PCI: microchip: " Fan Fei
2021-11-27 14:11 ` [PATCH 06/13] PCI: brcmstb: " Fan Fei
2021-11-27 14:11 ` [PATCH 07/13] PCI: mediatek-gen3: " Fan Fei
2021-11-27 14:11 ` [PATCH 08/13] PCI: rcar-gen2: " Fan Fei
2021-11-27 14:11 ` [PATCH 09/13] PCI: ftpci100: " Fan Fei
2021-11-27 14:11 ` [PATCH 10/13] PCI: v3-semi: " Fan Fei
2021-11-27 14:11 ` [PATCH 11/13] PCI: ixp4xx: " Fan Fei
2021-11-27 14:11 ` Fan Fei [this message]
2021-11-27 14:11 ` [PATCH 13/13] PCI: rcar: " Fan Fei
2021-12-23  0:43 ` [PATCH 00/13] Unify device * to " Bjorn Helgaas
2021-12-28 19:38   ` Fan Fei
2021-12-29 17:14     ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e0d29625125ca307768749c055e76feb552b9c8.1638022049.git.ffclaire1224@gmail.com \
    --to=ffclaire1224@gmail.com \
    --cc=bjorn@helgaas.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).