Skip to content

Commit 73be990

Browse files
committed
Fix dma_unmap_single on Linux <= 6
1 parent b999efb commit 73be990

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

driver/src/vfpga/vfpga_gup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ void tlb_unmap_gup(struct vfpga_dev *device, struct user_pages *user_pg, pid_t h
264264

265265
struct user_pages* tlb_get_user_pages(struct vfpga_dev *device, struct pf_aligned_desc *pf_desc, pid_t hpid, struct task_struct *curr_task, struct mm_struct *curr_mm) {
266266
int ret_val = 0;
267+
int pg_inc, pg_size;
267268
struct bus_driver_data *bd_data = device->bd_data;
268269

269270
// Error handling
@@ -428,8 +429,8 @@ struct user_pages* tlb_get_user_pages(struct vfpga_dev *device, struct pf_aligne
428429

429430
fail_dma_map:
430431
// Unmap DMA
431-
int pg_inc = pf_desc->hugepages ? device->bd_data->n_pages_in_huge : 1;
432-
int pg_size = pf_desc->hugepages ? device->bd_data->ltlb_meta->page_size : PAGE_SIZE;
432+
pg_inc = pf_desc->hugepages ? device->bd_data->n_pages_in_huge : 1;
433+
pg_size = pf_desc->hugepages ? device->bd_data->ltlb_meta->page_size : PAGE_SIZE;
433434
for (int i = 0; i < pf_desc->n_pages; i+=pg_inc) {
434435
dma_unmap_single(&device->bd_data->pci_dev->dev, user_pg->hpages[i], pg_size, DMA_BIDIRECTIONAL);
435436
}

0 commit comments

Comments
 (0)