diff mbox series

[v3,4/9] fpga: dfl: afu: define local pointer to feature device

Message ID 20240919203430.1278067-5-peter.colberg@intel.com (mailing list archive)
State New
Headers show
Series fpga: dfl: fix kernel warning on port release/assign for SRIOV | expand

Commit Message

Colberg, Peter Sept. 19, 2024, 8:34 p.m. UTC
Define local pointer to pdata->dev->dev to avoid repetition.

Signed-off-by: Peter Colberg <peter.colberg@intel.com>
Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
---
 drivers/fpga/dfl-afu-dma-region.c | 9 +++++----
 drivers/fpga/dfl-afu-region.c     | 5 +++--
 2 files changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
index 02b60fde0430..814191e623e1 100644
--- a/drivers/fpga/dfl-afu-dma-region.c
+++ b/drivers/fpga/dfl-afu-dma-region.c
@@ -301,6 +301,7 @@  afu_dma_region_find_iova(struct dfl_feature_platform_data *pdata, u64 iova)
 int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
 		       u64 user_addr, u64 length, u64 *iova)
 {
+	struct device *dev = &pdata->dev->dev;
 	struct dfl_afu_dma_region *region;
 	int ret;
 
@@ -325,13 +326,13 @@  int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
 	/* Pin the user memory region */
 	ret = afu_dma_pin_pages(pdata, region);
 	if (ret) {
-		dev_err(&pdata->dev->dev, "failed to pin memory region\n");
+		dev_err(dev, "failed to pin memory region\n");
 		goto free_region;
 	}
 
 	/* Only accept continuous pages, return error else */
 	if (!afu_dma_check_continuous_pages(region)) {
-		dev_err(&pdata->dev->dev, "pages are not continuous\n");
+		dev_err(dev, "pages are not continuous\n");
 		ret = -EINVAL;
 		goto unpin_pages;
 	}
@@ -342,7 +343,7 @@  int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
 				    region->length,
 				    DMA_BIDIRECTIONAL);
 	if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
-		dev_err(&pdata->dev->dev, "failed to map for dma\n");
+		dev_err(dev, "failed to map for dma\n");
 		ret = -EFAULT;
 		goto unpin_pages;
 	}
@@ -353,7 +354,7 @@  int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
 	ret = afu_dma_region_add(pdata, region);
 	mutex_unlock(&pdata->lock);
 	if (ret) {
-		dev_err(&pdata->dev->dev, "failed to add dma region\n");
+		dev_err(dev, "failed to add dma region\n");
 		goto unmap_dma;
 	}
 
diff --git a/drivers/fpga/dfl-afu-region.c b/drivers/fpga/dfl-afu-region.c
index 2e7b41629406..8f0e9485214a 100644
--- a/drivers/fpga/dfl-afu-region.c
+++ b/drivers/fpga/dfl-afu-region.c
@@ -50,11 +50,12 @@  static struct dfl_afu_mmio_region *get_region_by_index(struct dfl_afu *afu,
 int afu_mmio_region_add(struct dfl_feature_platform_data *pdata,
 			u32 region_index, u64 region_size, u64 phys, u32 flags)
 {
+	struct device *dev = &pdata->dev->dev;
 	struct dfl_afu_mmio_region *region;
 	struct dfl_afu *afu;
 	int ret = 0;
 
-	region = devm_kzalloc(&pdata->dev->dev, sizeof(*region), GFP_KERNEL);
+	region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL);
 	if (!region)
 		return -ENOMEM;
 
@@ -85,7 +86,7 @@  int afu_mmio_region_add(struct dfl_feature_platform_data *pdata,
 	return 0;
 
 exit:
-	devm_kfree(&pdata->dev->dev, region);
+	devm_kfree(dev, region);
 	return ret;
 }