Commit 20d3b647 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

iwlwifi: clean up coding style in PCIe transport

Mostly clean up indentation around parentheses
after if, function calls, etc. and also a few
unneeded line breaks and some other things.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: default avatarWey-Yi W Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ac91f910
...@@ -201,9 +201,7 @@ static inline __le32 iwlagn_dma_addr2rbd_ptr(dma_addr_t dma_addr) ...@@ -201,9 +201,7 @@ static inline __le32 iwlagn_dma_addr2rbd_ptr(dma_addr_t dma_addr)
*/ */
static void iwlagn_rx_queue_restock(struct iwl_trans *trans) static void iwlagn_rx_queue_restock(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
struct list_head *element; struct list_head *element;
struct iwl_rx_mem_buffer *rxb; struct iwl_rx_mem_buffer *rxb;
...@@ -253,9 +251,7 @@ static void iwlagn_rx_queue_restock(struct iwl_trans *trans) ...@@ -253,9 +251,7 @@ static void iwlagn_rx_queue_restock(struct iwl_trans *trans)
*/ */
static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority) static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
struct list_head *element; struct list_head *element;
struct iwl_rx_mem_buffer *rxb; struct iwl_rx_mem_buffer *rxb;
...@@ -278,8 +274,7 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority) ...@@ -278,8 +274,7 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
gfp_mask |= __GFP_COMP; gfp_mask |= __GFP_COMP;
/* Alloc a new receive buffer */ /* Alloc a new receive buffer */
page = alloc_pages(gfp_mask, page = alloc_pages(gfp_mask, trans_pcie->rx_page_order);
trans_pcie->rx_page_order);
if (!page) { if (!page) {
if (net_ratelimit()) if (net_ratelimit())
IWL_DEBUG_INFO(trans, "alloc_pages failed, " IWL_DEBUG_INFO(trans, "alloc_pages failed, "
...@@ -315,7 +310,8 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority) ...@@ -315,7 +310,8 @@ static void iwlagn_rx_allocate(struct iwl_trans *trans, gfp_t priority)
BUG_ON(rxb->page); BUG_ON(rxb->page);
rxb->page = page; rxb->page = page;
/* Get physical address of the RB */ /* Get physical address of the RB */
rxb->page_dma = dma_map_page(trans->dev, page, 0, rxb->page_dma =
dma_map_page(trans->dev, page, 0,
PAGE_SIZE << trans_pcie->rx_page_order, PAGE_SIZE << trans_pcie->rx_page_order,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
/* dma address must be no more than 36 bits */ /* dma address must be no more than 36 bits */
...@@ -549,9 +545,9 @@ static void iwl_irq_handle_error(struct iwl_trans *trans) ...@@ -549,9 +545,9 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
APMS_CLK_VAL_MRB_FUNC_MODE) || APMS_CLK_VAL_MRB_FUNC_MODE) ||
(iwl_read_prph(trans, APMG_PS_CTRL_REG) & (iwl_read_prph(trans, APMG_PS_CTRL_REG) &
APMG_PS_CTRL_VAL_RESET_REQ))) { APMG_PS_CTRL_VAL_RESET_REQ))) {
struct iwl_trans_pcie *trans_pcie; struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans);
trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status);
iwl_op_mode_wimax_active(trans->op_mode); iwl_op_mode_wimax_active(trans->op_mode);
wake_up(&trans->wait_command_queue); wake_up(&trans->wait_command_queue);
...@@ -567,6 +563,8 @@ static void iwl_irq_handle_error(struct iwl_trans *trans) ...@@ -567,6 +563,8 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
/* tasklet for iwlagn interrupt */ /* tasklet for iwlagn interrupt */
void iwl_irq_tasklet(struct iwl_trans *trans) void iwl_irq_tasklet(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
u32 inta = 0; u32 inta = 0;
u32 handled = 0; u32 handled = 0;
unsigned long flags; unsigned long flags;
...@@ -575,10 +573,6 @@ void iwl_irq_tasklet(struct iwl_trans *trans) ...@@ -575,10 +573,6 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
u32 inta_mask; u32 inta_mask;
#endif #endif
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
spin_lock_irqsave(&trans_pcie->irq_lock, flags); spin_lock_irqsave(&trans_pcie->irq_lock, flags);
/* Ack/clear/reset pending uCode interrupts. /* Ack/clear/reset pending uCode interrupts.
...@@ -782,8 +776,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans) ...@@ -782,8 +776,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
/* Free dram table */ /* Free dram table */
void iwl_free_isr_ict(struct iwl_trans *trans) void iwl_free_isr_ict(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
if (trans_pcie->ict_tbl) { if (trans_pcie->ict_tbl) {
dma_free_coherent(trans->dev, ICT_SIZE, dma_free_coherent(trans->dev, ICT_SIZE,
...@@ -802,8 +795,7 @@ void iwl_free_isr_ict(struct iwl_trans *trans) ...@@ -802,8 +795,7 @@ void iwl_free_isr_ict(struct iwl_trans *trans)
*/ */
int iwl_alloc_isr_ict(struct iwl_trans *trans) int iwl_alloc_isr_ict(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
trans_pcie->ict_tbl = trans_pcie->ict_tbl =
dma_alloc_coherent(trans->dev, ICT_SIZE, dma_alloc_coherent(trans->dev, ICT_SIZE,
...@@ -837,10 +829,9 @@ int iwl_alloc_isr_ict(struct iwl_trans *trans) ...@@ -837,10 +829,9 @@ int iwl_alloc_isr_ict(struct iwl_trans *trans)
*/ */
void iwl_reset_ict(struct iwl_trans *trans) void iwl_reset_ict(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u32 val; u32 val;
unsigned long flags; unsigned long flags;
struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans);
if (!trans_pcie->ict_tbl) if (!trans_pcie->ict_tbl)
return; return;
...@@ -868,9 +859,7 @@ void iwl_reset_ict(struct iwl_trans *trans) ...@@ -868,9 +859,7 @@ void iwl_reset_ict(struct iwl_trans *trans)
/* Device is going down disable ict interrupt usage */ /* Device is going down disable ict interrupt usage */
void iwl_disable_ict(struct iwl_trans *trans) void iwl_disable_ict(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&trans_pcie->irq_lock, flags); spin_lock_irqsave(&trans_pcie->irq_lock, flags);
......
...@@ -51,8 +51,7 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans, ...@@ -51,8 +51,7 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
u16 byte_cnt) u16 byte_cnt)
{ {
struct iwlagn_scd_bc_tbl *scd_bc_tbl; struct iwlagn_scd_bc_tbl *scd_bc_tbl;
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
int write_ptr = txq->q.write_ptr; int write_ptr = txq->q.write_ptr;
int txq_id = txq->q.id; int txq_id = txq->q.id;
u8 sec_ctl = 0; u8 sec_ctl = 0;
...@@ -385,13 +384,11 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans, ...@@ -385,13 +384,11 @@ static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_trans *trans,
static int iwlagn_tx_queue_set_q2ratid(struct iwl_trans *trans, u16 ra_tid, static int iwlagn_tx_queue_set_q2ratid(struct iwl_trans *trans, u16 ra_tid,
u16 txq_id) u16 txq_id)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u32 tbl_dw_addr; u32 tbl_dw_addr;
u32 tbl_dw; u32 tbl_dw;
u16 scd_q2ratid; u16 scd_q2ratid;
struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans);
scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK; scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK;
tbl_dw_addr = trans_pcie->scd_base_addr + tbl_dw_addr = trans_pcie->scd_base_addr +
...@@ -419,8 +416,7 @@ static void iwlagn_tx_queue_stop_scheduler(struct iwl_trans *trans, u16 txq_id) ...@@ -419,8 +416,7 @@ static void iwlagn_tx_queue_stop_scheduler(struct iwl_trans *trans, u16 txq_id)
(1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
} }
void iwl_trans_set_wr_ptrs(struct iwl_trans *trans, void iwl_trans_set_wr_ptrs(struct iwl_trans *trans, int txq_id, u32 index)
int txq_id, u32 index)
{ {
IWL_DEBUG_TX_QUEUES(trans, "Q %d WrPtr: %d\n", txq_id, index & 0xff); IWL_DEBUG_TX_QUEUES(trans, "Q %d WrPtr: %d\n", txq_id, index & 0xff);
iwl_write_direct32(trans, HBUS_TARG_WRPTR, iwl_write_direct32(trans, HBUS_TARG_WRPTR,
...@@ -617,8 +613,8 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -617,8 +613,8 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
IWL_DEBUG_HC(trans, IWL_DEBUG_HC(trans,
"Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n", "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n",
trans_pcie_get_cmd_string(trans_pcie, out_cmd->hdr.cmd), trans_pcie_get_cmd_string(trans_pcie, out_cmd->hdr.cmd),
out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), cmd_size, out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence),
q->write_ptr, idx, trans_pcie->cmd_queue); cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue);
phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size, phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
...@@ -630,8 +626,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -630,8 +626,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
dma_unmap_addr_set(out_meta, mapping, phys_addr); dma_unmap_addr_set(out_meta, mapping, phys_addr);
dma_unmap_len_set(out_meta, len, copy_size); dma_unmap_len_set(out_meta, len, copy_size);
iwlagn_txq_attach_buf_to_tfd(trans, txq, iwlagn_txq_attach_buf_to_tfd(trans, txq, phys_addr, copy_size, 1);
phys_addr, copy_size, 1);
#ifdef CONFIG_IWLWIFI_DEVICE_TRACING #ifdef CONFIG_IWLWIFI_DEVICE_TRACING
trace_bufs[0] = &out_cmd->hdr; trace_bufs[0] = &out_cmd->hdr;
trace_lens[0] = copy_size; trace_lens[0] = copy_size;
...@@ -643,8 +638,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -643,8 +638,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
continue; continue;
if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
continue; continue;
phys_addr = dma_map_single(trans->dev, phys_addr = dma_map_single(trans->dev, (void *)cmd->data[i],
(void *)cmd->data[i],
cmd->len[i], DMA_BIDIRECTIONAL); cmd->len[i], DMA_BIDIRECTIONAL);
if (dma_mapping_error(trans->dev, phys_addr)) { if (dma_mapping_error(trans->dev, phys_addr)) {
iwl_unmap_tfd(trans, out_meta, iwl_unmap_tfd(trans, out_meta,
...@@ -723,9 +717,10 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id, ...@@ -723,9 +717,10 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
lockdep_assert_held(&txq->lock); lockdep_assert_held(&txq->lock);
if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) { if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
IWL_ERR(trans, "%s: Read index for DMA queue txq id (%d), " IWL_ERR(trans,
"index %d is out of range [0-%d] %d %d.\n", __func__, "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n",
txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr); __func__, txq_id, idx, q->n_bd,
q->write_ptr, q->read_ptr);
return; return;
} }
...@@ -733,8 +728,8 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id, ...@@ -733,8 +728,8 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
if (nfreed++ > 0) { if (nfreed++ > 0) {
IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", idx, IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
q->write_ptr, q->read_ptr); idx, q->write_ptr, q->read_ptr);
iwl_op_mode_nic_error(trans->op_mode); iwl_op_mode_nic_error(trans->op_mode);
} }
...@@ -869,7 +864,8 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -869,7 +864,8 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
} }
ret = wait_event_timeout(trans->wait_command_queue, ret = wait_event_timeout(trans->wait_command_queue,
!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status), !test_bit(STATUS_HCMD_ACTIVE,
&trans_pcie->status),
HOST_COMPLETE_TIMEOUT); HOST_COMPLETE_TIMEOUT);
if (!ret) { if (!ret) {
if (test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { if (test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) {
...@@ -955,8 +951,8 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index, ...@@ -955,8 +951,8 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
if ((index >= q->n_bd) || if ((index >= q->n_bd) ||
(iwl_queue_used(q, last_to_free) == 0)) { (iwl_queue_used(q, last_to_free) == 0)) {
IWL_ERR(trans, "%s: Read index for DMA queue txq id (%d), " IWL_ERR(trans,
"last_to_free %d is out of range [0-%d] %d %d.\n", "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n",
__func__, txq_id, last_to_free, q->n_bd, __func__, txq_id, last_to_free, q->n_bd,
q->write_ptr, q->read_ptr); q->write_ptr, q->read_ptr);
return 0; return 0;
......
...@@ -84,8 +84,7 @@ ...@@ -84,8 +84,7 @@
static int iwl_trans_rx_alloc(struct iwl_trans *trans) static int iwl_trans_rx_alloc(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
struct device *dev = trans->dev; struct device *dev = trans->dev;
...@@ -121,8 +120,7 @@ static int iwl_trans_rx_alloc(struct iwl_trans *trans) ...@@ -121,8 +120,7 @@ static int iwl_trans_rx_alloc(struct iwl_trans *trans)
static void iwl_trans_rxq_free_rx_bufs(struct iwl_trans *trans) static void iwl_trans_rxq_free_rx_bufs(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
int i; int i;
...@@ -191,8 +189,7 @@ static void iwl_trans_rx_hw_init(struct iwl_trans *trans, ...@@ -191,8 +189,7 @@ static void iwl_trans_rx_hw_init(struct iwl_trans *trans,
static int iwl_rx_init(struct iwl_trans *trans) static int iwl_rx_init(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
int i, err; int i, err;
...@@ -234,10 +231,8 @@ static int iwl_rx_init(struct iwl_trans *trans) ...@@ -234,10 +231,8 @@ static int iwl_rx_init(struct iwl_trans *trans)
static void iwl_trans_pcie_rx_free(struct iwl_trans *trans) static void iwl_trans_pcie_rx_free(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
unsigned long flags; unsigned long flags;
/*if rxq->bd is NULL, it means that nothing has been allocated, /*if rxq->bd is NULL, it means that nothing has been allocated,
...@@ -275,7 +270,7 @@ static int iwl_trans_rx_stop(struct iwl_trans *trans) ...@@ -275,7 +270,7 @@ static int iwl_trans_rx_stop(struct iwl_trans *trans)
FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
} }
static inline int iwlagn_alloc_dma_ptr(struct iwl_trans *trans, static int iwlagn_alloc_dma_ptr(struct iwl_trans *trans,
struct iwl_dma_ptr *ptr, size_t size) struct iwl_dma_ptr *ptr, size_t size)
{ {
if (WARN_ON(ptr->addr)) if (WARN_ON(ptr->addr))
...@@ -289,7 +284,7 @@ static inline int iwlagn_alloc_dma_ptr(struct iwl_trans *trans, ...@@ -289,7 +284,7 @@ static inline int iwlagn_alloc_dma_ptr(struct iwl_trans *trans,
return 0; return 0;
} }
static inline void iwlagn_free_dma_ptr(struct iwl_trans *trans, static void iwlagn_free_dma_ptr(struct iwl_trans *trans,
struct iwl_dma_ptr *ptr) struct iwl_dma_ptr *ptr)
{ {
if (unlikely(!ptr->addr)) if (unlikely(!ptr->addr))
...@@ -330,9 +325,9 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans, ...@@ -330,9 +325,9 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
struct iwl_tx_queue *txq, int slots_num, struct iwl_tx_queue *txq, int slots_num,
u32 txq_id) u32 txq_id)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
int i; int i;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
if (WARN_ON(txq->entries || txq->tfds)) if (WARN_ON(txq->entries || txq->tfds))
return -EINVAL; return -EINVAL;
...@@ -453,6 +448,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id) ...@@ -453,6 +448,7 @@ static void iwl_tx_queue_free(struct iwl_trans *trans, int txq_id)
struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id]; struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
struct device *dev = trans->dev; struct device *dev = trans->dev;
int i; int i;
if (WARN_ON(!txq)) if (WARN_ON(!txq))
return; return;
...@@ -572,11 +568,11 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans) ...@@ -572,11 +568,11 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
} }
static int iwl_tx_init(struct iwl_trans *trans) static int iwl_tx_init(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
int ret; int ret;
int txq_id, slots_num; int txq_id, slots_num;
unsigned long flags; unsigned long flags;
bool alloc = false; bool alloc = false;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
if (!trans_pcie->txq) { if (!trans_pcie->txq) {
ret = iwl_trans_tx_alloc(trans); ret = iwl_trans_tx_alloc(trans);
...@@ -641,10 +637,9 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans) ...@@ -641,10 +637,9 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans)
static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans) static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
int pos; int pos;
u16 pci_lnk_ctl; u16 pci_lnk_ctl;
struct iwl_trans_pcie *trans_pcie =
IWL_TRANS_GET_PCIE_TRANS(trans);
struct pci_dev *pci_dev = trans_pcie->pci_dev; struct pci_dev *pci_dev = trans_pcie->pci_dev;
...@@ -814,8 +809,7 @@ static int iwl_nic_init(struct iwl_trans *trans) ...@@ -814,8 +809,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
iwl_apm_init(trans); iwl_apm_init(trans);
/* Set interrupt coalescing calibration timer to default (512 usecs) */ /* Set interrupt coalescing calibration timer to default (512 usecs) */
iwl_write8(trans, CSR_INT_COALESCING, iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF);
IWL_HOST_INT_CALIB_TIMEOUT_DEF);
spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
...@@ -834,8 +828,7 @@ static int iwl_nic_init(struct iwl_trans *trans) ...@@ -834,8 +828,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
if (trans->cfg->base_params->shadow_reg_enable) { if (trans->cfg->base_params->shadow_reg_enable) {
/* enable shadow regs in HW */ /* enable shadow regs in HW */
iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, 0x800FFFFF);
0x800FFFFF);
} }
return 0; return 0;
...@@ -910,7 +903,8 @@ static int iwl_load_section(struct iwl_trans *trans, u8 section_num, ...@@ -910,7 +903,8 @@ static int iwl_load_section(struct iwl_trans *trans, u8 section_num,
FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE);
iwl_write_direct32(trans, iwl_write_direct32(trans,
FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr); FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL),
dst_addr);
iwl_write_direct32(trans, iwl_write_direct32(trans,
FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
...@@ -1127,9 +1121,9 @@ static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans) ...@@ -1127,9 +1121,9 @@ static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans)
*/ */
static int iwl_trans_tx_stop(struct iwl_trans *trans) static int iwl_trans_tx_stop(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
int ch, txq_id, ret; int ch, txq_id, ret;
unsigned long flags; unsigned long flags;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
/* Turn off all Tx DMA fifos */ /* Turn off all Tx DMA fifos */
spin_lock_irqsave(&trans_pcie->irq_lock, flags); spin_lock_irqsave(&trans_pcie->irq_lock, flags);
...@@ -1141,11 +1135,11 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans) ...@@ -1141,11 +1135,11 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
iwl_write_direct32(trans, iwl_write_direct32(trans,
FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0);
ret = iwl_poll_direct_bit(trans, FH_TSSR_TX_STATUS_REG, ret = iwl_poll_direct_bit(trans, FH_TSSR_TX_STATUS_REG,
FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), 1000);
1000);
if (ret < 0) if (ret < 0)
IWL_ERR(trans, "Failing on timeout while stopping" IWL_ERR(trans,
" DMA channel %d [0x%08x]", ch, "Failing on timeout while stopping DMA channel %d [0x%08x]",
ch,
iwl_read_direct32(trans, iwl_read_direct32(trans,
FH_TSSR_TX_STATUS_REG)); FH_TSSR_TX_STATUS_REG));
} }
...@@ -1166,8 +1160,8 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans) ...@@ -1166,8 +1160,8 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
{ {
unsigned long flags;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
unsigned long flags;
/* tell the device to stop sending interrupts */ /* tell the device to stop sending interrupts */
spin_lock_irqsave(&trans_pcie->irq_lock, flags); spin_lock_irqsave(&trans_pcie->irq_lock, flags);
...@@ -1271,7 +1265,8 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, ...@@ -1271,7 +1265,8 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
txq->entries[q->write_ptr].cmd = dev_cmd; txq->entries[q->write_ptr].cmd = dev_cmd;
dev_cmd->hdr.cmd = REPLY_TX; dev_cmd->hdr.cmd = REPLY_TX;
dev_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | dev_cmd->hdr.sequence =
cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
INDEX_TO_SEQ(q->write_ptr))); INDEX_TO_SEQ(q->write_ptr)));
/* Set up first empty entry in queue's array of Tx/cmd buffers */ /* Set up first empty entry in queue's array of Tx/cmd buffers */
...@@ -1388,8 +1383,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, ...@@ -1388,8 +1383,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
int err; int err;
bool hw_rfkill; bool hw_rfkill;
...@@ -1440,9 +1434,9 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) ...@@ -1440,9 +1434,9 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans, static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans,
bool op_mode_leaving) bool op_mode_leaving)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
bool hw_rfkill; bool hw_rfkill;
unsigned long flags; unsigned long flags;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
iwl_apm_stop(trans); iwl_apm_stop(trans);
...@@ -1546,8 +1540,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, ...@@ -1546,8 +1540,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
void iwl_trans_pcie_free(struct iwl_trans *trans) void iwl_trans_pcie_free(struct iwl_trans *trans)
{ {
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
iwl_trans_pcie_tx_free(trans); iwl_trans_pcie_tx_free(trans);
#ifndef CONFIG_IWLWIFI_IDI #ifndef CONFIG_IWLWIFI_IDI
...@@ -1847,10 +1840,10 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, ...@@ -1847,10 +1840,10 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
static ssize_t iwl_dbgfs_rx_queue_read(struct file *file, static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
char __user *user_buf, char __user *user_buf,
size_t count, loff_t *ppos) { size_t count, loff_t *ppos)
{
struct iwl_trans *trans = file->private_data; struct iwl_trans *trans = file->private_data;
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_rx_queue *rxq = &trans_pcie->rxq; struct iwl_rx_queue *rxq = &trans_pcie->rxq;
char buf[256]; char buf[256];
int pos = 0; int pos = 0;
...@@ -1874,11 +1867,10 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file, ...@@ -1874,11 +1867,10 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
static ssize_t iwl_dbgfs_interrupt_read(struct file *file, static ssize_t iwl_dbgfs_interrupt_read(struct file *file,
char __user *user_buf, char __user *user_buf,
size_t count, loff_t *ppos) { size_t count, loff_t *ppos)
{
struct iwl_trans *trans = file->private_data; struct iwl_trans *trans = file->private_data;
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct isr_statistics *isr_stats = &trans_pcie->isr_stats; struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
int pos = 0; int pos = 0;
...@@ -1936,8 +1928,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file, ...@@ -1936,8 +1928,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct iwl_trans *trans = file->private_data; struct iwl_trans *trans = file->private_data;
struct iwl_trans_pcie *trans_pcie = struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
IWL_TRANS_GET_PCIE_TRANS(trans);
struct isr_statistics *isr_stats = &trans_pcie->isr_stats; struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
char buf[8]; char buf[8];
...@@ -2035,8 +2026,9 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, ...@@ -2035,8 +2026,9 @@ static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
#else #else
static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans,
struct dentry *dir) struct dentry *dir)
{ return 0; } {
return 0;
}
#endif /*CONFIG_IWLWIFI_DEBUGFS */ #endif /*CONFIG_IWLWIFI_DEBUGFS */
static const struct iwl_trans_ops trans_ops_pcie = { static const struct iwl_trans_ops trans_ops_pcie = {
...@@ -2183,4 +2175,3 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, ...@@ -2183,4 +2175,3 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
kfree(trans); kfree(trans);
return NULL; return NULL;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment