mmc: bcm2835: Refactor dma_map_sg handling
There are two variables len within bcm2835_prepare_dma. So rename the result of dma_map_sg to sg_len. While we are at this add a bail out to simplify the following change. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
37fefadee8
commit
6dc6f26190
@ -453,7 +453,7 @@ static void bcm2835_transfer_pio(struct bcm2835_host *host)
|
|||||||
static
|
static
|
||||||
void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
|
void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
|
||||||
{
|
{
|
||||||
int len, dir_data, dir_slave;
|
int sg_len, dir_data, dir_slave;
|
||||||
struct dma_async_tx_descriptor *desc = NULL;
|
struct dma_async_tx_descriptor *desc = NULL;
|
||||||
struct dma_chan *dma_chan;
|
struct dma_chan *dma_chan;
|
||||||
|
|
||||||
@ -499,15 +499,13 @@ void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
|
|||||||
&host->dma_cfg_rx :
|
&host->dma_cfg_rx :
|
||||||
&host->dma_cfg_tx);
|
&host->dma_cfg_tx);
|
||||||
|
|
||||||
len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len,
|
sg_len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len,
|
||||||
dir_data);
|
dir_data);
|
||||||
|
if (!sg_len)
|
||||||
|
return;
|
||||||
|
|
||||||
if (len > 0) {
|
desc = dmaengine_prep_slave_sg(dma_chan, data->sg, sg_len, dir_slave,
|
||||||
desc = dmaengine_prep_slave_sg(dma_chan, data->sg,
|
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
|
||||||
len, dir_slave,
|
|
||||||
DMA_PREP_INTERRUPT |
|
|
||||||
DMA_CTRL_ACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desc) {
|
if (desc) {
|
||||||
desc->callback = bcm2835_dma_complete;
|
desc->callback = bcm2835_dma_complete;
|
||||||
|
Loading…
Reference in New Issue
Block a user