Skip to content

Commit

Permalink
spi: s3c64xx: Use dmaengine_prep_slave_single() to prepare DMA transfers
Browse files Browse the repository at this point in the history
Since the driver supports only contiguous buffers, there is no need to
manually construct a scatterlist with just a single entry, when there is
a dedicated helper for this purpose.

This patch modifies prepare_dma() function to use available helper instead
of manually creating a scatterlist.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Tomasz Figa authored and Mark Brown committed Aug 11, 2013
1 parent 0149871 commit 90438c4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions drivers/spi/spi-s3c64xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
{
struct s3c64xx_spi_driver_data *sdd;
struct dma_slave_config config;
struct scatterlist sg;
struct dma_async_tx_descriptor *desc;

memset(&config, 0, sizeof(config));
Expand All @@ -412,14 +411,8 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
dmaengine_slave_config(dma->ch, &config);
}

sg_init_table(&sg, 1);
sg_dma_len(&sg) = len;
sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)),
len, offset_in_page(buf));
sg_dma_address(&sg) = buf;

desc = dmaengine_prep_slave_sg(dma->ch,
&sg, 1, dma->direction, DMA_PREP_INTERRUPT);
desc = dmaengine_prep_slave_single(dma->ch, buf, len,
dma->direction, DMA_PREP_INTERRUPT);

desc->callback = s3c64xx_spi_dmacb;
desc->callback_param = dma;
Expand Down

0 comments on commit 90438c4

Please sign in to comment.