diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2015-01-28 07:23:52 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-28 14:42:43 -0500 |
commit | b563bfb8d76762fe5a4db1e4f983f3647d60e456 (patch) | |
tree | 437c647cc1623b3ba910923c4cec5a86a2f47ceb /drivers/spi | |
parent | 99082eab63449f9dfa83d5157fa6d78bfc1b04d7 (diff) |
spi/xilinx: Remove remaining_words driver data variable
The variable never leaves the scope of txrx_bufs.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-xilinx.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 8c25c59df7b0..026f4c59a941 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -86,7 +86,6 @@ struct xilinx_spi { | |||
86 | 86 | ||
87 | u8 *rx_ptr; /* pointer in the Tx buffer */ | 87 | u8 *rx_ptr; /* pointer in the Tx buffer */ |
88 | const u8 *tx_ptr; /* pointer in the Rx buffer */ | 88 | const u8 *tx_ptr; /* pointer in the Rx buffer */ |
89 | int remaining_words; /* the number of words left to transfer */ | ||
90 | u8 bytes_per_word; | 89 | u8 bytes_per_word; |
91 | int buffer_size; /* buffer size in words */ | 90 | int buffer_size; /* buffer size in words */ |
92 | u32 cs_inactive; /* Level of the CS pins when inactive*/ | 91 | u32 cs_inactive; /* Level of the CS pins when inactive*/ |
@@ -209,33 +208,27 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi, | |||
209 | return 0; | 208 | return 0; |
210 | } | 209 | } |
211 | 210 | ||
212 | static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi, int n_words) | ||
213 | { | ||
214 | xspi->remaining_words -= n_words; | ||
215 | |||
216 | while (n_words--) | ||
217 | xilinx_spi_tx(xspi); | ||
218 | return; | ||
219 | } | ||
220 | |||
221 | static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | 211 | static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) |
222 | { | 212 | { |
223 | struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); | 213 | struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); |
214 | int remaining_words; /* the number of words left to transfer */ | ||
224 | 215 | ||
225 | /* We get here with transmitter inhibited */ | 216 | /* We get here with transmitter inhibited */ |
226 | 217 | ||
227 | xspi->tx_ptr = t->tx_buf; | 218 | xspi->tx_ptr = t->tx_buf; |
228 | xspi->rx_ptr = t->rx_buf; | 219 | xspi->rx_ptr = t->rx_buf; |
229 | xspi->remaining_words = t->len / xspi->bytes_per_word; | 220 | remaining_words = t->len / xspi->bytes_per_word; |
230 | reinit_completion(&xspi->done); | 221 | reinit_completion(&xspi->done); |
231 | 222 | ||
232 | while (xspi->remaining_words) { | 223 | while (remaining_words) { |
233 | u16 cr = 0; | 224 | u16 cr = 0; |
234 | int n_words; | 225 | int n_words, tx_words, rx_words; |
235 | 226 | ||
236 | n_words = min(xspi->remaining_words, xspi->buffer_size); | 227 | n_words = min(remaining_words, xspi->buffer_size); |
237 | 228 | ||
238 | xilinx_spi_fill_tx_fifo(xspi, n_words); | 229 | tx_words = n_words; |
230 | while (tx_words--) | ||
231 | xilinx_spi_tx(xspi); | ||
239 | 232 | ||
240 | /* Start the transfer by not inhibiting the transmitter any | 233 | /* Start the transfer by not inhibiting the transmitter any |
241 | * longer | 234 | * longer |
@@ -261,8 +254,11 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
261 | xspi->regs + XSPI_CR_OFFSET); | 254 | xspi->regs + XSPI_CR_OFFSET); |
262 | 255 | ||
263 | /* Read out all the data from the Rx FIFO */ | 256 | /* Read out all the data from the Rx FIFO */ |
264 | while (n_words--) | 257 | rx_words = n_words; |
258 | while (rx_words--) | ||
265 | xilinx_spi_rx(xspi); | 259 | xilinx_spi_rx(xspi); |
260 | |||
261 | remaining_words -= n_words; | ||
266 | } | 262 | } |
267 | 263 | ||
268 | return t->len; | 264 | return t->len; |