diff options
author | Himangi Saraogi <himangi774@gmail.com> | 2014-08-02 09:52:04 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-08-17 19:03:43 -0400 |
commit | 3a73aeff37c2e425b11d19c19e42e8269d58d417 (patch) | |
tree | fbb568f13b8c4a91e1b272001263fa2a06bfbce4 | |
parent | b25a437206ed5d45087bc40bd48bc34ce3bfa008 (diff) |
can: mcp251x: Use dmam_alloc_coherent
This patch moves the data allocated using dma_alloc_coherent to the
corresponding managed interface and does away with the calls to free the
allocated memory in the probe and remove functions.
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r-- | drivers/net/can/spi/mcp251x.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index 5df239e68812..c66d699640a9 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c | |||
@@ -1107,10 +1107,10 @@ static int mcp251x_can_probe(struct spi_device *spi) | |||
1107 | * Minimum coherent DMA allocation is PAGE_SIZE, so allocate | 1107 | * Minimum coherent DMA allocation is PAGE_SIZE, so allocate |
1108 | * that much and share it between Tx and Rx DMA buffers. | 1108 | * that much and share it between Tx and Rx DMA buffers. |
1109 | */ | 1109 | */ |
1110 | priv->spi_tx_buf = dma_alloc_coherent(&spi->dev, | 1110 | priv->spi_tx_buf = dmam_alloc_coherent(&spi->dev, |
1111 | PAGE_SIZE, | 1111 | PAGE_SIZE, |
1112 | &priv->spi_tx_dma, | 1112 | &priv->spi_tx_dma, |
1113 | GFP_DMA); | 1113 | GFP_DMA); |
1114 | 1114 | ||
1115 | if (priv->spi_tx_buf) { | 1115 | if (priv->spi_tx_buf) { |
1116 | priv->spi_rx_buf = (priv->spi_tx_buf + (PAGE_SIZE / 2)); | 1116 | priv->spi_rx_buf = (priv->spi_tx_buf + (PAGE_SIZE / 2)); |
@@ -1156,9 +1156,6 @@ static int mcp251x_can_probe(struct spi_device *spi) | |||
1156 | return 0; | 1156 | return 0; |
1157 | 1157 | ||
1158 | error_probe: | 1158 | error_probe: |
1159 | if (mcp251x_enable_dma) | ||
1160 | dma_free_coherent(&spi->dev, PAGE_SIZE, | ||
1161 | priv->spi_tx_buf, priv->spi_tx_dma); | ||
1162 | mcp251x_power_enable(priv->power, 0); | 1159 | mcp251x_power_enable(priv->power, 0); |
1163 | 1160 | ||
1164 | out_clk: | 1161 | out_clk: |
@@ -1178,11 +1175,6 @@ static int mcp251x_can_remove(struct spi_device *spi) | |||
1178 | 1175 | ||
1179 | unregister_candev(net); | 1176 | unregister_candev(net); |
1180 | 1177 | ||
1181 | if (mcp251x_enable_dma) { | ||
1182 | dma_free_coherent(&spi->dev, PAGE_SIZE, | ||
1183 | priv->spi_tx_buf, priv->spi_tx_dma); | ||
1184 | } | ||
1185 | |||
1186 | mcp251x_power_enable(priv->power, 0); | 1178 | mcp251x_power_enable(priv->power, 0); |
1187 | 1179 | ||
1188 | if (!IS_ERR(priv->clk)) | 1180 | if (!IS_ERR(priv->clk)) |