static int wlan_tx_msg_q_free(wlan_vif_t *vif) { int q_id, num, i; msg_q_t *msg_q; tx_msg_t *msg; for (q_id = 0; q_id < 2; q_id++) { msg_q = &(vif->msg_q[q_id]); num = msg_num(msg_q); for (i = 0; i < num; i++) { msg = msg_get(msg_q); if (NULL == msg) break; msg_free(msg_q, msg); } msg_q_free(msg_q); } tx_fifo_free(&(vif->txfifo)); return OK; }
static void tx_fifo_write(struct lantiq_ssc_spi *spi) { const u8 *tx8; const u16 *tx16; const u32 *tx32; u32 data; unsigned int tx_free = tx_fifo_free(spi); while (spi->tx_todo && tx_free) { switch (spi->bits_per_word) { case 2 ... 8: tx8 = spi->tx; data = *tx8; spi->tx_todo--; spi->tx++; break; case 16: tx16 = (u16 *) spi->tx; data = *tx16; spi->tx_todo -= 2; spi->tx += 2; break; case 32: tx32 = (u32 *) spi->tx; data = *tx32; spi->tx_todo -= 4; spi->tx += 4; break; default: WARN_ON(1); data = 0; break; } lantiq_ssc_writel(spi, data, LTQ_SPI_TB); tx_free--; } }