mirror of
https://github.com/nxp-imx/mwifiex.git
synced 2025-01-15 16:25:35 +00:00
mxm_wifiex: fix the build errors with the API changes on L5.18 kernel
L5.18 kernel removed the wrappers in include/linux/pci-dma-compat.h, so need to switch from 'pci_dma' to 'dma_' API. Also, to make it unambiguous that mmc_hw_reset() is for cards and not for controllers, L5.18 kernel make the function argument mmc_card instead of mmc_host. Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
This commit is contained in:
parent
f6055d3fc2
commit
638d8eae2a
3 changed files with 35 additions and 2 deletions
|
@ -1126,13 +1126,21 @@ static mlan_status woal_pcie_preinit(struct pci_dev *pdev)
|
|||
pci_set_master(pdev);
|
||||
|
||||
PRINTM(MINFO, "Try set_consistent_dma_mask(32)\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
|
||||
#else
|
||||
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||
#endif
|
||||
if (ret) {
|
||||
PRINTM(MERROR, "set_dma_mask(32) failed\n");
|
||||
goto err_set_dma_mask;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
|
||||
#else
|
||||
ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||
#endif
|
||||
if (ret) {
|
||||
PRINTM(MERROR, "set_consistent_dma_mask(64) failed\n");
|
||||
goto err_set_dma_mask;
|
||||
|
|
|
@ -1183,7 +1183,11 @@ static void woal_sdiommc_unregister_dev(moal_handle *handle)
|
|||
sdio_release_irq(card->func);
|
||||
sdio_disable_func(card->func);
|
||||
if (handle->driver_status)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
mmc_hw_reset(func->card);
|
||||
#else
|
||||
mmc_hw_reset(func->card->host);
|
||||
#endif
|
||||
sdio_release_host(card->func);
|
||||
|
||||
sdio_set_drvdata(card->func, NULL);
|
||||
|
@ -2464,7 +2468,11 @@ void woal_sdio_reset_hw(moal_handle *handle)
|
|||
sdio_claim_host(func);
|
||||
sdio_release_irq(card->func);
|
||||
sdio_disable_func(card->func);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
mmc_hw_reset(func->card);
|
||||
#else
|
||||
mmc_hw_reset(func->card->host);
|
||||
#endif
|
||||
#ifdef MMC_QUIRK_BLKSZ_FOR_BYTE_MODE
|
||||
/* The byte mode patch is available in kernel MMC driver
|
||||
* which fixes one issue in MP-A transfer.
|
||||
|
|
|
@ -200,8 +200,13 @@ mlan_status moal_malloc_consistent(t_void *pmoal, t_u32 size, t_u8 **ppbuf,
|
|||
if (!card)
|
||||
return MLAN_STATUS_FAILURE;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
*ppbuf = (t_u8 *)dma_alloc_coherent(&card->dev->dev, size,
|
||||
(dma_addr_t *)&dma, GFP_KERNEL);
|
||||
#else
|
||||
*ppbuf = (t_u8 *)pci_alloc_consistent(card->dev, size,
|
||||
(dma_addr_t *)&dma);
|
||||
#endif
|
||||
if (*ppbuf == NULL) {
|
||||
PRINTM(MERROR,
|
||||
"%s: allocate consistent memory (%d bytes) failed!\n",
|
||||
|
@ -233,7 +238,11 @@ mlan_status moal_mfree_consistent(t_void *pmoal, t_u32 size, t_u8 *pbuf,
|
|||
if (!pbuf || !card)
|
||||
return MLAN_STATUS_FAILURE;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
dma_free_coherent(&card->dev->dev, size, pbuf, buf_pa);
|
||||
#else
|
||||
pci_free_consistent(card->dev, size, pbuf, buf_pa);
|
||||
#endif
|
||||
atomic_dec(&handle->malloc_cons_count);
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -261,13 +270,17 @@ mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, t_u64 *pbuf_pa,
|
|||
return MLAN_STATUS_FAILURE;
|
||||
|
||||
/* Init memory to device */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
dma = dma_map_single(&card->dev->dev, pbuf, size, flag);
|
||||
if (dma_mapping_error(&card->dev->dev, dma)) {
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
||||
dma = pci_map_single(card->dev, pbuf, size, flag);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
||||
if (pci_dma_mapping_error(card->dev, dma)) {
|
||||
#else
|
||||
dma = pci_map_single(card->dev, pbuf, size, flag);
|
||||
if (pci_dma_mapping_error(dma)) {
|
||||
#endif
|
||||
PRINTM(MERROR, "Tx ring: failed to pci_map_single\n");
|
||||
PRINTM(MERROR, "Tx ring: failed to dma_map_single\n");
|
||||
return MLAN_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -295,7 +308,11 @@ mlan_status moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, t_u64 buf_pa,
|
|||
if (!card)
|
||||
return MLAN_STATUS_FAILURE;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
dma_unmap_single(&card->dev->dev, buf_pa, size, flag);
|
||||
#else
|
||||
pci_unmap_single(card->dev, buf_pa, size, flag);
|
||||
#endif
|
||||
|
||||
return MLAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue