[PATCH 2/4] dma-iommu: replace device arguments

From: David Stevens
Date: Wed Jul 07 2021 - 03:55:37 EST


From: David Stevens <stevensd@xxxxxxxxxxxx>

Replace the struct device argument with the device's nid in
__iommu_dma_alloc_pages, since it doesn't need the whole struct. This
allows it to be called from places which don't have access to the
device.

Signed-off-by: David Stevens <stevensd@xxxxxxxxxxxx>
---
drivers/iommu/dma-iommu.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 00993b56c977..98a5c566a303 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -592,12 +592,12 @@ static void __iommu_dma_free_pages(struct page **pages, int count)
kvfree(pages);
}

-static struct page **__iommu_dma_alloc_pages(struct device *dev,
+static struct page **__iommu_dma_alloc_pages(
unsigned int count, unsigned long order_mask,
- gfp_t page_gfp, gfp_t kalloc_gfp)
+ unsigned int nid, gfp_t page_gfp, gfp_t kalloc_gfp)
{
struct page **pages;
- unsigned int i = 0, nid = dev_to_node(dev);
+ unsigned int i = 0;

order_mask &= (2U << MAX_ORDER) - 1;
if (!order_mask)
@@ -680,8 +680,8 @@ static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev,
alloc_sizes = min_size;

count = PAGE_ALIGN(size) >> PAGE_SHIFT;
- pages = __iommu_dma_alloc_pages(dev, count, alloc_sizes >> PAGE_SHIFT,
- gfp, GFP_KERNEL);
+ pages = __iommu_dma_alloc_pages(count, alloc_sizes >> PAGE_SHIFT,
+ dev_to_node(dev), gfp, GFP_KERNEL);
if (!pages)
return NULL;

--
2.32.0.93.g670b81a890-goog