Skip to content

Commit

Permalink
spi/davinci: Use correct length parameter to dma_map_single calls
Browse files Browse the repository at this point in the history
The davinci spi driver provides an option to use DMA transfers for
data.  In the dma_map_single() call, the driver is passing the
number of words to be transfered for the mapping size.  It should
be the number of bytes.

Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Michael Williamson authored and Grant Likely committed Mar 14, 2011
1 parent fc1599f commit d09519e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/spi/davinci_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)

if (t->tx_buf) {
t->tx_dma = dma_map_single(&spi->dev, (void *)t->tx_buf,
dspi->wcount, DMA_TO_DEVICE);
t->len, DMA_TO_DEVICE);
if (dma_mapping_error(&spi->dev, t->tx_dma)) {
dev_dbg(sdev, "Unable to DMA map %d bytes"
"TX buffer\n", dspi->wcount);
"TX buffer\n", t->len);
return -ENOMEM;
}
}
Expand Down Expand Up @@ -624,7 +624,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)

if (t->rx_buf) {
rx_buf = t->rx_buf;
rx_buf_count = dspi->rcount;
rx_buf_count = t->len;
} else {
rx_buf = dspi->rx_tmp_buf;
rx_buf_count = sizeof(dspi->rx_tmp_buf);
Expand All @@ -636,7 +636,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n",
rx_buf_count);
if (t->tx_buf)
dma_unmap_single(NULL, t->tx_dma, dspi->wcount,
dma_unmap_single(NULL, t->tx_dma, t->len,
DMA_TO_DEVICE);
return -ENOMEM;
}
Expand Down Expand Up @@ -675,7 +675,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
if (spicfg->io_type == SPI_IO_TYPE_DMA) {

if (t->tx_buf)
dma_unmap_single(NULL, t->tx_dma, dspi->wcount,
dma_unmap_single(NULL, t->tx_dma, t->len,
DMA_TO_DEVICE);

dma_unmap_single(NULL, t->rx_dma, rx_buf_count,
Expand Down

0 comments on commit d09519e

Please sign in to comment.