File opensuse156.patch of Package crystalhd
diff -Nraub crystalhd-driver.ori/crystalhd_lnx.c crystalhd-driver/crystalhd_lnx.c
--- crystalhd-driver.ori/crystalhd_lnx.c 2023-12-31 15:20:15.483614274 -0400
+++ crystalhd-driver/crystalhd_lnx.c 2023-12-31 15:21:47.972643071 -0400
@@ -450,7 +450,7 @@
}
/* register crystalhd class */
- crystalhd_class = class_create(THIS_MODULE, "crystalhd");
+ crystalhd_class = class_create("crystalhd");
if (IS_ERR(crystalhd_class)) {
dev_err(xdev, "failed to create class\n");
goto fail;
@@ -667,11 +667,11 @@
}
/* Set dma mask... */
- if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
- pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+ if (!dma_set_mask((struct device *) &pdev, DMA_BIT_MASK(64))) {
+ dma_set_coherent_mask((struct device *) &pdev, DMA_BIT_MASK(64));
pinfo->dmabits = 64;
- } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
- pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
+ } else if (!dma_set_mask((struct device *) &pdev, DMA_BIT_MASK(32))) {
+ dma_set_coherent_mask((struct device *) &pdev, DMA_BIT_MASK(32));
pinfo->dmabits = 32;
} else {
dev_err(dev, "%s: Unabled to setup DMA %d\n", __func__, rc);
diff -Nraub crystalhd-driver.ori/crystalhd_lnx.h crystalhd-driver/crystalhd_lnx.h
--- crystalhd-driver.ori/crystalhd_lnx.h 2023-12-31 15:19:48.052495495 -0400
+++ crystalhd-driver/crystalhd_lnx.h 2023-12-31 15:21:37.536978316 -0400
@@ -83,7 +83,7 @@
struct crystalhd_cmd cmds;
struct crystalhd_dio_req *ua_map_free_head;
- struct pci_pool *fill_byte_pool;
+ struct dma_pool *fill_byte_pool;
};
diff -Nraub crystalhd-driver.ori/crystalhd_misc.c crystalhd-driver/crystalhd_misc.c
--- crystalhd-driver.ori/crystalhd_misc.c 2023-12-31 15:20:29.543162612 -0400
+++ crystalhd-driver/crystalhd_misc.c 2023-12-31 15:21:53.156476540 -0400
@@ -240,7 +240,7 @@
return temp;
}
- temp = pci_alloc_consistent(adp->pdev, sz, phy_addr);
+ temp = dma_alloc_coherent(&((struct pci_dev *)adp->pdev)->dev, sz, phy_addr, GFP_ATOMIC);
if (temp)
memset(temp, 0, sz);
@@ -266,7 +266,7 @@
return;
}
- pci_free_consistent(adp->pdev, sz, ka, phy_addr);
+ dma_free_coherent(&((struct pci_dev *)adp->pdev)->dev, sz, ka, phy_addr);
}
/**
@@ -653,7 +653,7 @@
}
mmap_read_lock(current->mm);
- res = get_user_pages(uaddr, nr_pages, rw == READ, dio->pages, NULL);
+ res = get_user_pages(uaddr, nr_pages, rw == READ, dio->pages);
mmap_read_unlock(current->mm);
/* Save for release..*/
@@ -702,7 +702,7 @@
#endif
#endif
}
- dio->sg_cnt = pci_map_sg(adp->pdev, dio->sg,
+ dio->sg_cnt = dma_map_sg(&adp->pdev->dev, dio->sg,
dio->page_cnt, dio->direction);
if (dio->sg_cnt <= 0) {
dev_err(dev, "sg map %d-%d\n", dio->sg_cnt, dio->page_cnt);
@@ -756,7 +756,7 @@
}
}
if (dio->sig == crystalhd_dio_sg_mapped)
- pci_unmap_sg(adp->pdev, dio->sg, dio->page_cnt, dio->direction);
+ dma_unmap_sg(&adp->pdev->dev, dio->sg, dio->page_cnt, dio->direction);
crystalhd_free_dio(adp, dio);
@@ -789,8 +789,8 @@
dev = &adp->pdev->dev;
/* Get dma memory for fill byte handling..*/
- adp->fill_byte_pool = pci_pool_create("crystalhd_fbyte",
- adp->pdev, 8, 8, 0);
+ adp->fill_byte_pool = dma_pool_create("crystalhd_fbyte",
+ &(adp->pdev)->dev, 8, 8, 0);
if (!adp->fill_byte_pool) {
dev_err(dev, "failed to create fill byte pool\n");
return -ENOMEM;
@@ -816,7 +816,7 @@
temp += (sizeof(*dio->pages) * max_pages);
dio->sg = (struct scatterlist *)temp;
dio->max_pages = max_pages;
- dio->fb_va = pci_pool_alloc(adp->fill_byte_pool, GFP_KERNEL,
+ dio->fb_va = dma_pool_alloc(adp->fill_byte_pool, GFP_KERNEL,
&dio->fb_pa);
if (!dio->fb_va) {
dev_err(dev, "fill byte alloc failed.\n");
@@ -852,7 +852,7 @@
dio = crystalhd_alloc_dio(adp);
if (dio) {
if (dio->fb_va)
- pci_pool_free(adp->fill_byte_pool,
+ dma_pool_free(adp->fill_byte_pool,
dio->fb_va, dio->fb_pa);
count++;
kfree(dio);
@@ -860,7 +860,7 @@
} while (dio);
if (adp->fill_byte_pool) {
- pci_pool_destroy(adp->fill_byte_pool);
+ dma_pool_destroy(adp->fill_byte_pool);
adp->fill_byte_pool = NULL;
}