aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-09-23 19:24:59 -0400
committerMike Frysinger <vapier@gentoo.org>2010-10-18 02:49:31 -0400
commit5cc0159a5779f297d1b987d5f6d0feb6dc36a27a (patch)
tree1995cdcf754d098dcf66d72868e376836e52b54a /drivers/spi
parent201bbc6fd84c67b4021f454d3e4c30d5cd77f702 (diff)
spi/bfin_spi: punt useless null read/write funcs
The chip ops should always be initialized, so having null fallback functions are useless. Reported-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_bfin5xx.c47
1 files changed, 5 insertions, 42 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index f4023a78c87e..5e07f498b495 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -255,43 +255,6 @@ static inline void bfin_spi_dummy_read(struct driver_data *drv_data)
255 (void) read_RDBR(drv_data); 255 (void) read_RDBR(drv_data);
256} 256}
257 257
258static void bfin_spi_null_writer(struct driver_data *drv_data)
259{
260 u8 n_bytes = drv_data->n_bytes;
261 u16 tx_val = drv_data->cur_chip->idle_tx_val;
262
263 /* clear RXS (we check for RXS inside the loop) */
264 bfin_spi_dummy_read(drv_data);
265
266 while (drv_data->tx < drv_data->tx_end) {
267 write_TDBR(drv_data, tx_val);
268 drv_data->tx += n_bytes;
269 /* wait until transfer finished.
270 checking SPIF or TXS may not guarantee transfer completion */
271 while (!(read_STAT(drv_data) & BIT_STAT_RXS))
272 cpu_relax();
273 /* discard RX data and clear RXS */
274 bfin_spi_dummy_read(drv_data);
275 }
276}
277
278static void bfin_spi_null_reader(struct driver_data *drv_data)
279{
280 u8 n_bytes = drv_data->n_bytes;
281 u16 tx_val = drv_data->cur_chip->idle_tx_val;
282
283 /* discard old RX data and clear RXS */
284 bfin_spi_dummy_read(drv_data);
285
286 while (drv_data->rx < drv_data->rx_end) {
287 write_TDBR(drv_data, tx_val);
288 drv_data->rx += n_bytes;
289 while (!(read_STAT(drv_data) & BIT_STAT_RXS))
290 cpu_relax();
291 bfin_spi_dummy_read(drv_data);
292 }
293}
294
295static void bfin_spi_u8_writer(struct driver_data *drv_data) 258static void bfin_spi_u8_writer(struct driver_data *drv_data)
296{ 259{
297 /* clear RXS (we check for RXS inside the loop) */ 260 /* clear RXS (we check for RXS inside the loop) */
@@ -680,9 +643,9 @@ static void bfin_spi_pump_transfers(unsigned long data)
680 transfer->bits_per_word = chip->bits_per_word; 643 transfer->bits_per_word = chip->bits_per_word;
681 drv_data->n_bytes = chip->n_bytes; 644 drv_data->n_bytes = chip->n_bytes;
682 width = chip->width; 645 width = chip->width;
683 drv_data->write = drv_data->tx ? chip->write : bfin_spi_null_writer; 646 drv_data->write = chip->write;
684 drv_data->read = drv_data->rx ? chip->read : bfin_spi_null_reader; 647 drv_data->read = chip->read;
685 drv_data->duplex = chip->duplex ? chip->duplex : bfin_spi_null_writer; 648 drv_data->duplex = chip->duplex;
686 break; 649 break;
687 } 650 }
688 cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); 651 cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD));
@@ -695,8 +658,8 @@ static void bfin_spi_pump_transfers(unsigned long data)
695 drv_data->len = transfer->len; 658 drv_data->len = transfer->len;
696 } 659 }
697 dev_dbg(&drv_data->pdev->dev, 660 dev_dbg(&drv_data->pdev->dev,
698 "transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n", 661 "transfer: drv_data->write is %p, chip->write is %p\n",
699 drv_data->write, chip->write, bfin_spi_null_writer); 662 drv_data->write, chip->write);
700 663
701 /* speed and width has been set on per message */ 664 /* speed and width has been set on per message */
702 message->state = RUNNING_STATE; 665 message->state = RUNNING_STATE;