linux-cxl.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-cxl@vger.kernel.org
Cc: Ira Weiny <ira.weiny@intel.com>
Subject: [PATCH] cxl/pci: Fixup devm_cxl_iomap_block() to take a 'struct device *'
Date: Thu, 27 May 2021 18:39:11 -0700	[thread overview]
Message-ID: <162216592374.3833641.13281743585064451514.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)

The expectation is that devm functions take 'struct device *' and pci
functions take 'struct pci_dev *'. Swap out the @pdev argument for @dev
and fixup related helpers.

Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---

base-commit: 6630d31c912ed2dfbc035caf0f54709b50ce779e

 drivers/cxl/core.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/cxl/core.c b/drivers/cxl/core.c
index f41a38e87606..80e6d65f8652 100644
--- a/drivers/cxl/core.c
+++ b/drivers/cxl/core.c
@@ -154,15 +154,14 @@ void cxl_probe_device_regs(struct device *dev, void __iomem *base,
 }
 EXPORT_SYMBOL_GPL(cxl_probe_device_regs);
 
-static void __iomem *devm_cxl_iomap_block(struct pci_dev *pdev,
+static void __iomem *devm_cxl_iomap_block(struct device *dev,
 					  resource_size_t addr,
 					  resource_size_t length)
 {
-	struct device *dev = &pdev->dev;
 	void __iomem *ret_val;
 	struct resource *res;
 
-	res = devm_request_mem_region(dev, addr, length, pci_name(pdev));
+	res = devm_request_mem_region(dev, addr, length, dev_name(dev));
 	if (!res) {
 		dev_err(dev, "Failed to request region %#llx-%#llx\n",
 			addr, addr+length);
@@ -181,6 +180,7 @@ int cxl_map_component_regs(struct pci_dev *pdev,
 			   struct cxl_component_regs *regs,
 			   struct cxl_register_map *map)
 {
+	struct device *dev = &pdev->dev;
 	resource_size_t phys_addr;
 	resource_size_t length;
 
@@ -189,7 +189,7 @@ int cxl_map_component_regs(struct pci_dev *pdev,
 
 	phys_addr += map->component_map.hdm_decoder.offset;
 	length = map->component_map.hdm_decoder.size;
-	regs->hdm_decoder = devm_cxl_iomap_block(pdev, phys_addr, length);
+	regs->hdm_decoder = devm_cxl_iomap_block(dev, phys_addr, length);
 	if (!regs->hdm_decoder)
 		return -ENOMEM;
 
@@ -201,6 +201,7 @@ int cxl_map_device_regs(struct pci_dev *pdev,
 			struct cxl_device_regs *regs,
 			struct cxl_register_map *map)
 {
+	struct device *dev = &pdev->dev;
 	resource_size_t phys_addr;
 
 	phys_addr = pci_resource_start(pdev, map->barno);
@@ -212,7 +213,7 @@ int cxl_map_device_regs(struct pci_dev *pdev,
 
 		addr = phys_addr + map->device_map.status.offset;
 		length = map->device_map.status.size;
-		regs->status = devm_cxl_iomap_block(pdev, addr, length);
+		regs->status = devm_cxl_iomap_block(dev, addr, length);
 		if (!regs->status)
 			return -ENOMEM;
 	}
@@ -223,7 +224,7 @@ int cxl_map_device_regs(struct pci_dev *pdev,
 
 		addr = phys_addr + map->device_map.mbox.offset;
 		length = map->device_map.mbox.size;
-		regs->mbox = devm_cxl_iomap_block(pdev, addr, length);
+		regs->mbox = devm_cxl_iomap_block(dev, addr, length);
 		if (!regs->mbox)
 			return -ENOMEM;
 	}
@@ -234,7 +235,7 @@ int cxl_map_device_regs(struct pci_dev *pdev,
 
 		addr = phys_addr + map->device_map.memdev.offset;
 		length = map->device_map.memdev.size;
-		regs->memdev = devm_cxl_iomap_block(pdev, addr, length);
+		regs->memdev = devm_cxl_iomap_block(dev, addr, length);
 		if (!regs->memdev)
 			return -ENOMEM;
 	}


             reply	other threads:[~2021-05-28  1:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  1:39 Dan Williams [this message]
2021-05-28 11:10 ` [PATCH] cxl/pci: Fixup devm_cxl_iomap_block() to take a 'struct device *' Jonathan Cameron
2021-06-02 22:23 ` Ira Weiny

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=162216592374.3833641.13281743585064451514.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@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).