mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
spi: use dmaengine_get_dma_device() instead of chan->device->dev
Replace direct dma_chan::device::dev access with the proper dmaengine_get_dma_device() for consumer API chan->device->dev is not always the device used for DMA mapping. Some DMA engines support per-channel IOMMU mappings, so different channels may use different DMA devices. dmaengine_get_dma_device() returns the correct device for each channel. This also prepares for making the DMA engine provider data structures private. DMA consumers should not access DMA engine internals directly. Assisted-by: LLM Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260930140257.490019-2-Frank.Li@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2d57d6fd1f
commit
853de617c4
|
|
@ -527,7 +527,7 @@ static void bcm2835_spi_transfer_prologue(struct spi_controller *ctlr,
|
|||
| BCM2835_SPI_CS_CLEAR_TX
|
||||
| BCM2835_SPI_CS_DONE);
|
||||
|
||||
dma_sync_single_for_device(ctlr->dma_rx->device->dev,
|
||||
dma_sync_single_for_device(dmaengine_get_dma_device(ctlr->dma_rx),
|
||||
sg_dma_address(&tfr->rx_sg.sgl[0]),
|
||||
bs->rx_prologue, DMA_FROM_DEVICE);
|
||||
|
||||
|
|
@ -871,7 +871,7 @@ static void bcm2835_dma_release(struct spi_controller *ctlr,
|
|||
dmaengine_desc_free(bs->fill_tx_desc);
|
||||
|
||||
if (bs->fill_tx_addr)
|
||||
dma_unmap_page_attrs(ctlr->dma_tx->device->dev,
|
||||
dma_unmap_page_attrs(dmaengine_get_dma_device(ctlr->dma_tx),
|
||||
bs->fill_tx_addr, sizeof(u32),
|
||||
DMA_TO_DEVICE,
|
||||
DMA_ATTR_SKIP_CPU_SYNC);
|
||||
|
|
@ -891,6 +891,7 @@ static int bcm2835_dma_init(struct spi_controller *ctlr, struct device *dev,
|
|||
struct bcm2835_spi *bs)
|
||||
{
|
||||
struct dma_slave_config slave_config;
|
||||
struct device *tx_dma_dev;
|
||||
const __be32 *addr;
|
||||
dma_addr_t dma_reg_base;
|
||||
int ret;
|
||||
|
|
@ -932,11 +933,13 @@ static int bcm2835_dma_init(struct spi_controller *ctlr, struct device *dev,
|
|||
if (ret)
|
||||
goto err_config;
|
||||
|
||||
bs->fill_tx_addr = dma_map_page_attrs(ctlr->dma_tx->device->dev,
|
||||
tx_dma_dev = dmaengine_get_dma_device(ctlr->dma_tx);
|
||||
|
||||
bs->fill_tx_addr = dma_map_page_attrs(tx_dma_dev,
|
||||
ZERO_PAGE(0), 0, sizeof(u32),
|
||||
DMA_TO_DEVICE,
|
||||
DMA_ATTR_SKIP_CPU_SYNC);
|
||||
if (dma_mapping_error(ctlr->dma_tx->device->dev, bs->fill_tx_addr)) {
|
||||
if (dma_mapping_error(tx_dma_dev, bs->fill_tx_addr)) {
|
||||
dev_err(dev, "cannot map zero page - not using DMA mode\n");
|
||||
bs->fill_tx_addr = 0;
|
||||
ret = -ENOMEM;
|
||||
|
|
@ -1157,7 +1160,7 @@ static void bcm2835_spi_cleanup(struct spi_device *spi)
|
|||
dmaengine_desc_free(target->clear_rx_desc);
|
||||
|
||||
if (target->clear_rx_addr)
|
||||
dma_unmap_single(ctlr->dma_rx->device->dev,
|
||||
dma_unmap_single(dmaengine_get_dma_device(ctlr->dma_rx),
|
||||
target->clear_rx_addr,
|
||||
sizeof(u32),
|
||||
DMA_TO_DEVICE);
|
||||
|
|
@ -1174,16 +1177,16 @@ static int bcm2835_spi_setup_dma(struct spi_controller *ctlr,
|
|||
struct bcm2835_spi *bs,
|
||||
struct bcm2835_spidev *target)
|
||||
{
|
||||
struct device *rx_dev;
|
||||
int ret;
|
||||
|
||||
if (!ctlr->dma_rx)
|
||||
return 0;
|
||||
|
||||
target->clear_rx_addr = dma_map_single(ctlr->dma_rx->device->dev,
|
||||
&target->clear_rx_cs,
|
||||
sizeof(u32),
|
||||
DMA_TO_DEVICE);
|
||||
if (dma_mapping_error(ctlr->dma_rx->device->dev, target->clear_rx_addr)) {
|
||||
rx_dev = dmaengine_get_dma_device(ctlr->dma_rx);
|
||||
target->clear_rx_addr = dma_map_single(rx_dev, &target->clear_rx_cs,
|
||||
sizeof(u32), DMA_TO_DEVICE);
|
||||
if (dma_mapping_error(rx_dev, target->clear_rx_addr)) {
|
||||
dev_err(&spi->dev, "cannot map clear_rx_cs\n");
|
||||
target->clear_rx_addr = 0;
|
||||
return -ENOMEM;
|
||||
|
|
@ -1268,7 +1271,7 @@ static int bcm2835_spi_setup(struct spi_device *spi)
|
|||
target->clear_rx_cs = cs | BCM2835_SPI_CS_TA |
|
||||
BCM2835_SPI_CS_DMAEN |
|
||||
BCM2835_SPI_CS_CLEAR_RX;
|
||||
dma_sync_single_for_device(ctlr->dma_rx->device->dev,
|
||||
dma_sync_single_for_device(dmaengine_get_dma_device(ctlr->dma_rx),
|
||||
target->clear_rx_addr,
|
||||
sizeof(u32),
|
||||
DMA_TO_DEVICE);
|
||||
|
|
|
|||
|
|
@ -1382,7 +1382,7 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata,
|
|||
return 0;
|
||||
}
|
||||
|
||||
ddev = cqspi->rx_chan->device->dev;
|
||||
ddev = dmaengine_get_dma_device(cqspi->rx_chan);
|
||||
dma_dst = dma_map_single(ddev, buf, len, DMA_FROM_DEVICE);
|
||||
if (dma_mapping_error(ddev, dma_dst)) {
|
||||
dev_err(dev, "dma mapping failed\n");
|
||||
|
|
|
|||
|
|
@ -273,6 +273,7 @@ ep93xx_spi_dma_prepare(struct spi_controller *host,
|
|||
struct dma_async_tx_descriptor *txd;
|
||||
enum dma_slave_buswidth buswidth;
|
||||
struct dma_slave_config conf;
|
||||
struct device *dma_dev;
|
||||
struct scatterlist *sg;
|
||||
struct sg_table *sgt;
|
||||
struct dma_chan *chan;
|
||||
|
|
@ -348,14 +349,15 @@ ep93xx_spi_dma_prepare(struct spi_controller *host,
|
|||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
nents = dma_map_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
|
||||
dma_dev = dmaengine_get_dma_device(chan);
|
||||
nents = dma_map_sg(dma_dev, sgt->sgl, sgt->nents, dir);
|
||||
if (!nents)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
txd = dmaengine_prep_slave_sg(chan, sgt->sgl, nents, conf.direction,
|
||||
DMA_CTRL_ACK);
|
||||
if (!txd) {
|
||||
dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
|
||||
dma_unmap_sg(dma_dev, sgt->sgl, sgt->nents, dir);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
return txd;
|
||||
|
|
@ -384,7 +386,7 @@ static void ep93xx_spi_dma_finish(struct spi_controller *host,
|
|||
sgt = &espi->tx_sgt;
|
||||
}
|
||||
|
||||
dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir);
|
||||
dma_unmap_sg(dmaengine_get_dma_device(chan), sgt->sgl, sgt->nents, dir);
|
||||
}
|
||||
|
||||
static void ep93xx_spi_dma_callback(void *callback_param)
|
||||
|
|
|
|||
|
|
@ -670,6 +670,7 @@ static void dspi_dma_xfer(struct fsl_dspi *dspi)
|
|||
static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
|
||||
{
|
||||
struct device *dev = &dspi->pdev->dev;
|
||||
struct device *tx_dev, *rx_dev;
|
||||
struct dma_slave_config cfg;
|
||||
struct fsl_dspi_dma *dma;
|
||||
int ret;
|
||||
|
|
@ -688,20 +689,23 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
|
|||
goto err_tx_channel;
|
||||
}
|
||||
|
||||
tx_dev = dmaengine_get_dma_device(dma->chan_tx);
|
||||
rx_dev = dmaengine_get_dma_device(dma->chan_rx);
|
||||
|
||||
if (spi_controller_is_target(dspi->ctlr)) {
|
||||
/*
|
||||
* In target mode we have to be ready to receive the maximum
|
||||
* that can possibly be transferred at once by EDMA without any
|
||||
* FIFO underflows.
|
||||
*/
|
||||
dma->bufsize = min(dma_get_max_seg_size(dma->chan_rx->device->dev),
|
||||
dma_get_max_seg_size(dma->chan_tx->device->dev)) *
|
||||
dma->bufsize = min(dma_get_max_seg_size(rx_dev),
|
||||
dma_get_max_seg_size(tx_dev)) *
|
||||
DMA_SLAVE_BUSWIDTH_4_BYTES;
|
||||
} else {
|
||||
dma->bufsize = PAGE_SIZE;
|
||||
}
|
||||
|
||||
dma->tx_dma_buf = dma_alloc_noncoherent(dma->chan_tx->device->dev,
|
||||
dma->tx_dma_buf = dma_alloc_noncoherent(tx_dev,
|
||||
dma->bufsize, &dma->tx_dma_phys,
|
||||
DMA_TO_DEVICE, GFP_KERNEL);
|
||||
if (!dma->tx_dma_buf) {
|
||||
|
|
@ -709,7 +713,7 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
|
|||
goto err_tx_dma_buf;
|
||||
}
|
||||
|
||||
dma->rx_dma_buf = dma_alloc_noncoherent(dma->chan_rx->device->dev,
|
||||
dma->rx_dma_buf = dma_alloc_noncoherent(rx_dev,
|
||||
dma->bufsize, &dma->rx_dma_phys,
|
||||
DMA_FROM_DEVICE, GFP_KERNEL);
|
||||
if (!dma->rx_dma_buf) {
|
||||
|
|
@ -746,12 +750,11 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr)
|
|||
return 0;
|
||||
|
||||
err_slave_config:
|
||||
dma_free_noncoherent(dma->chan_rx->device->dev, dma->bufsize,
|
||||
dma->rx_dma_buf, dma->rx_dma_phys,
|
||||
DMA_FROM_DEVICE);
|
||||
dma_free_noncoherent(rx_dev, dma->bufsize, dma->rx_dma_buf,
|
||||
dma->rx_dma_phys, DMA_FROM_DEVICE);
|
||||
err_rx_dma_buf:
|
||||
dma_free_noncoherent(dma->chan_tx->device->dev, dma->bufsize,
|
||||
dma->tx_dma_buf, dma->tx_dma_phys, DMA_TO_DEVICE);
|
||||
dma_free_noncoherent(tx_dev, dma->bufsize, dma->tx_dma_buf,
|
||||
dma->tx_dma_phys, DMA_TO_DEVICE);
|
||||
err_tx_dma_buf:
|
||||
dma_release_channel(dma->chan_tx);
|
||||
err_tx_channel:
|
||||
|
|
@ -771,16 +774,18 @@ static void dspi_release_dma(struct fsl_dspi *dspi)
|
|||
return;
|
||||
|
||||
if (dma->chan_tx) {
|
||||
dma_free_noncoherent(dma->chan_tx->device->dev, dma->bufsize,
|
||||
dma->tx_dma_buf, dma->tx_dma_phys,
|
||||
DMA_TO_DEVICE);
|
||||
struct device *tx_dev = dmaengine_get_dma_device(dma->chan_tx);
|
||||
|
||||
dma_free_noncoherent(tx_dev, dma->bufsize, dma->tx_dma_buf,
|
||||
dma->tx_dma_phys, DMA_TO_DEVICE);
|
||||
dma_release_channel(dma->chan_tx);
|
||||
}
|
||||
|
||||
if (dma->chan_rx) {
|
||||
dma_free_noncoherent(dma->chan_rx->device->dev, dma->bufsize,
|
||||
dma->rx_dma_buf, dma->rx_dma_phys,
|
||||
DMA_FROM_DEVICE);
|
||||
struct device *rx_dev = dmaengine_get_dma_device(dma->chan_rx);
|
||||
|
||||
dma_free_noncoherent(rx_dev, dma->bufsize, dma->rx_dma_buf,
|
||||
dma->rx_dma_phys, DMA_FROM_DEVICE);
|
||||
dma_release_channel(dma->chan_rx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1467,8 +1467,8 @@ static int spi_imx_calculate_timeout(struct spi_imx_data *spi_imx, int size)
|
|||
static void spi_imx_dma_unmap(struct spi_imx_data *spi_imx,
|
||||
struct dma_data_package *dma_data)
|
||||
{
|
||||
struct device *tx_dev = spi_imx->controller->dma_tx->device->dev;
|
||||
struct device *rx_dev = spi_imx->controller->dma_rx->device->dev;
|
||||
struct device *tx_dev = dmaengine_get_dma_device(spi_imx->controller->dma_tx);
|
||||
struct device *rx_dev = dmaengine_get_dma_device(spi_imx->controller->dma_rx);
|
||||
|
||||
dma_unmap_single(tx_dev, dma_data->dma_tx_addr,
|
||||
DMA_CACHE_ALIGNED_LEN(dma_data->dma_len),
|
||||
|
|
@ -1526,8 +1526,8 @@ static int spi_imx_dma_map(struct spi_imx_data *spi_imx,
|
|||
struct dma_data_package *dma_data)
|
||||
{
|
||||
struct spi_controller *controller = spi_imx->controller;
|
||||
struct device *tx_dev = controller->dma_tx->device->dev;
|
||||
struct device *rx_dev = controller->dma_rx->device->dev;
|
||||
struct device *tx_dev = dmaengine_get_dma_device(controller->dma_tx);
|
||||
struct device *rx_dev = dmaengine_get_dma_device(controller->dma_rx);
|
||||
int ret;
|
||||
|
||||
dma_data->dma_tx_addr = dma_map_single(tx_dev, dma_data->dma_tx_buf,
|
||||
|
|
@ -1919,7 +1919,7 @@ static int spi_imx_dma_package_transfer(struct spi_imx_data *spi_imx,
|
|||
return ret;
|
||||
|
||||
/* Trim the DMA RX buffer and copy the actual data to rx_buf */
|
||||
dma_sync_single_for_cpu(controller->dma_rx->device->dev, dma_data->dma_rx_addr,
|
||||
dma_sync_single_for_cpu(dmaengine_get_dma_device(controller->dma_rx), dma_data->dma_rx_addr,
|
||||
dma_data->dma_len, DMA_FROM_DEVICE);
|
||||
spi_imx_dma_rx_data_handle(spi_imx, dma_data, transfer->rx_buf + spi_imx->rx_offset,
|
||||
word_delay);
|
||||
|
|
|
|||
|
|
@ -841,23 +841,23 @@ static int nxp_xspi_ahb_dma_read(struct nxp_xspi *xspi,
|
|||
{
|
||||
struct dma_async_tx_descriptor *desc;
|
||||
struct dma_chan *chan = xspi->dma_rx;
|
||||
struct device *dma_dev = dmaengine_get_dma_device(chan);
|
||||
unsigned long timeout;
|
||||
dma_addr_t src_addr, dst_addr;
|
||||
int ret = 0;
|
||||
|
||||
dst_addr = dma_map_single(chan->device->dev,
|
||||
op->data.buf.in, op->data.nbytes,
|
||||
dst_addr = dma_map_single(dma_dev, op->data.buf.in, op->data.nbytes,
|
||||
DMA_FROM_DEVICE);
|
||||
if (dma_mapping_error(chan->device->dev, dst_addr)) {
|
||||
if (dma_mapping_error(dma_dev, dst_addr)) {
|
||||
dev_err(xspi->dev, "failed to map DMA dst buffer\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
src_addr = dma_map_resource(chan->device->dev,
|
||||
src_addr = dma_map_resource(dma_dev,
|
||||
(phys_addr_t)xspi->memmap_phy + op->addr.val,
|
||||
op->data.nbytes,
|
||||
DMA_TO_DEVICE, 0);
|
||||
if (dma_mapping_error(chan->device->dev, src_addr)) {
|
||||
if (dma_mapping_error(dma_dev, src_addr)) {
|
||||
dev_err(xspi->dev, "failed to map DMA src resource\n");
|
||||
ret = -ENOMEM;
|
||||
goto err_unmap_dst;
|
||||
|
|
@ -886,12 +886,10 @@ static int nxp_xspi_ahb_dma_read(struct nxp_xspi *xspi,
|
|||
}
|
||||
|
||||
err_unmap_src:
|
||||
dma_unmap_resource(chan->device->dev, src_addr,
|
||||
op->data.nbytes, DMA_TO_DEVICE, 0);
|
||||
dma_unmap_resource(dma_dev, src_addr, op->data.nbytes, DMA_TO_DEVICE, 0);
|
||||
|
||||
err_unmap_dst:
|
||||
dma_unmap_single(chan->device->dev, dst_addr,
|
||||
op->data.nbytes, DMA_FROM_DEVICE);
|
||||
dma_unmap_single(dma_dev, dst_addr, op->data.nbytes, DMA_FROM_DEVICE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -684,9 +684,9 @@ static void readwriter(struct pl022 *pl022)
|
|||
static void unmap_free_dma_scatter(struct pl022 *pl022)
|
||||
{
|
||||
/* Unmap and free the SG tables */
|
||||
dma_unmap_sg(pl022->dma_tx_channel->device->dev, pl022->sgt_tx.sgl,
|
||||
dma_unmap_sg(dmaengine_get_dma_device(pl022->dma_tx_channel), pl022->sgt_tx.sgl,
|
||||
pl022->sgt_tx.nents, DMA_TO_DEVICE);
|
||||
dma_unmap_sg(pl022->dma_rx_channel->device->dev, pl022->sgt_rx.sgl,
|
||||
dma_unmap_sg(dmaengine_get_dma_device(pl022->dma_rx_channel), pl022->sgt_rx.sgl,
|
||||
pl022->sgt_rx.nents, DMA_FROM_DEVICE);
|
||||
sg_free_table(&pl022->sgt_rx);
|
||||
sg_free_table(&pl022->sgt_tx);
|
||||
|
|
@ -811,6 +811,7 @@ static int configure_dma(struct pl022 *pl022)
|
|||
struct dma_chan *txchan = pl022->dma_tx_channel;
|
||||
struct dma_async_tx_descriptor *rxdesc;
|
||||
struct dma_async_tx_descriptor *txdesc;
|
||||
struct device *rx_dev, *tx_dev;
|
||||
|
||||
/* Check that the channels are available */
|
||||
if (!rxchan || !txchan)
|
||||
|
|
@ -924,14 +925,16 @@ static int configure_dma(struct pl022 *pl022)
|
|||
setup_dma_scatter(pl022, pl022->tx,
|
||||
pl022->cur_transfer->len, &pl022->sgt_tx);
|
||||
|
||||
rx_dev = dmaengine_get_dma_device(rxchan);
|
||||
/* Map DMA buffers */
|
||||
rx_sglen = dma_map_sg(rxchan->device->dev, pl022->sgt_rx.sgl,
|
||||
pl022->sgt_rx.nents, DMA_FROM_DEVICE);
|
||||
rx_sglen = dma_map_sg(rx_dev, pl022->sgt_rx.sgl,
|
||||
pl022->sgt_rx.nents, DMA_FROM_DEVICE);
|
||||
if (!rx_sglen)
|
||||
goto err_rx_sgmap;
|
||||
|
||||
tx_sglen = dma_map_sg(txchan->device->dev, pl022->sgt_tx.sgl,
|
||||
pl022->sgt_tx.nents, DMA_TO_DEVICE);
|
||||
tx_dev = dmaengine_get_dma_device(txchan);
|
||||
tx_sglen = dma_map_sg(tx_dev, pl022->sgt_tx.sgl,
|
||||
pl022->sgt_tx.nents, DMA_TO_DEVICE);
|
||||
if (!tx_sglen)
|
||||
goto err_tx_sgmap;
|
||||
|
||||
|
|
@ -969,10 +972,10 @@ static int configure_dma(struct pl022 *pl022)
|
|||
dmaengine_terminate_all(txchan);
|
||||
err_rxdesc:
|
||||
dmaengine_terminate_all(rxchan);
|
||||
dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl,
|
||||
dma_unmap_sg(tx_dev, pl022->sgt_tx.sgl,
|
||||
pl022->sgt_tx.nents, DMA_TO_DEVICE);
|
||||
err_tx_sgmap:
|
||||
dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl,
|
||||
dma_unmap_sg(rx_dev, pl022->sgt_rx.sgl,
|
||||
pl022->sgt_rx.nents, DMA_FROM_DEVICE);
|
||||
err_rx_sgmap:
|
||||
sg_free_table(&pl022->sgt_tx);
|
||||
|
|
|
|||
|
|
@ -674,7 +674,7 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
|
|||
|
||||
if (tx) {
|
||||
ier_bits |= SIIER_TDREQE | SIIER_TDMAE;
|
||||
dma_sync_single_for_device(p->ctlr->dma_tx->device->dev,
|
||||
dma_sync_single_for_device(dmaengine_get_dma_device(p->ctlr->dma_tx),
|
||||
p->tx_dma_addr, len, DMA_TO_DEVICE);
|
||||
desc_tx = dmaengine_prep_slave_single(p->ctlr->dma_tx,
|
||||
p->tx_dma_addr, len, DMA_MEM_TO_DEV,
|
||||
|
|
@ -754,7 +754,7 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
|
|||
}
|
||||
|
||||
if (rx)
|
||||
dma_sync_single_for_cpu(p->ctlr->dma_rx->device->dev,
|
||||
dma_sync_single_for_cpu(dmaengine_get_dma_device(p->ctlr->dma_rx),
|
||||
p->rx_dma_addr, len, DMA_FROM_DEVICE);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1142,13 +1142,13 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
|
|||
if (!p->rx_dma_page)
|
||||
goto free_tx_page;
|
||||
|
||||
tx_dev = ctlr->dma_tx->device->dev;
|
||||
tx_dev = dmaengine_get_dma_device(ctlr->dma_tx);
|
||||
p->tx_dma_addr = dma_map_single(tx_dev, p->tx_dma_page, PAGE_SIZE,
|
||||
DMA_TO_DEVICE);
|
||||
if (dma_mapping_error(tx_dev, p->tx_dma_addr))
|
||||
goto free_rx_page;
|
||||
|
||||
rx_dev = ctlr->dma_rx->device->dev;
|
||||
rx_dev = dmaengine_get_dma_device(ctlr->dma_rx);
|
||||
p->rx_dma_addr = dma_map_single(rx_dev, p->rx_dma_page, PAGE_SIZE,
|
||||
DMA_FROM_DEVICE);
|
||||
if (dma_mapping_error(rx_dev, p->rx_dma_addr))
|
||||
|
|
@ -1178,9 +1178,9 @@ static void sh_msiof_release_dma(struct sh_msiof_spi_priv *p)
|
|||
if (!ctlr->dma_tx)
|
||||
return;
|
||||
|
||||
dma_unmap_single(ctlr->dma_rx->device->dev, p->rx_dma_addr, PAGE_SIZE,
|
||||
dma_unmap_single(dmaengine_get_dma_device(ctlr->dma_rx), p->rx_dma_addr, PAGE_SIZE,
|
||||
DMA_FROM_DEVICE);
|
||||
dma_unmap_single(ctlr->dma_tx->device->dev, p->tx_dma_addr, PAGE_SIZE,
|
||||
dma_unmap_single(dmaengine_get_dma_device(ctlr->dma_tx), p->tx_dma_addr, PAGE_SIZE,
|
||||
DMA_TO_DEVICE);
|
||||
free_page((unsigned long)p->rx_dma_page);
|
||||
free_page((unsigned long)p->tx_dma_page);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user