diff --git a/drivers/net/wireless/cw1200/bh.c b/drivers/net/wireless/cw1200/bh.c index cdc0cce..1fe3ab9 100644 --- a/drivers/net/wireless/cw1200/bh.c +++ b/drivers/net/wireless/cw1200/bh.c @@ -509,7 +509,7 @@ static int cw1200_bh(void *arg) /* Check to see if we have any outstanding frames */ if (priv->hw_bufs_used && (!rx || !tx)) { wiphy_warn(priv->hw->wiphy, - "Missed interrupt? (%d frames outstanding)\n", + "Missed interrupt? (%d frames outstanding)\n", priv->hw_bufs_used); rx = 1; diff --git a/drivers/net/wireless/cw1200/debug.c b/drivers/net/wireless/cw1200/debug.c index aafc24a..8637876 100644 --- a/drivers/net/wireless/cw1200/debug.c +++ b/drivers/net/wireless/cw1200/debug.c @@ -614,9 +614,9 @@ static int parse_sdd_file(struct cw1200_common *priv, u8 *data, u32 length) char *etf_firmware; -#define ST90TDS_START_ADAPTER 0x09 /* Loads Firmware and start the adapter */ -#define ST90TDS_STOP_ADAPTER 0x0A /* Stops the adapter */ -#define ST90TDS_CONFIG_ADAPTER 0x0E /* Send adapter configuration params */ +#define ST90TDS_START_ADAPTER 0x09 /* Loads firmware too */ +#define ST90TDS_STOP_ADAPTER 0x0A +#define ST90TDS_CONFIG_ADAPTER 0x0E /* Send configuration params */ #define ST90TDS_SBUS_READ 0x13 #define ST90TDS_SBUS_WRITE 0x14 #define ST90TDS_GET_DEVICE_OPTION 0x19 diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c index a6ca686..ad01cd2 100644 --- a/drivers/net/wireless/cw1200/fwio.c +++ b/drivers/net/wireless/cw1200/fwio.c @@ -268,7 +268,9 @@ static int config_reg_read(struct cw1200_common *priv, u32 *val) switch (priv->hw_type) { case HIF_9000_SILICON_VERSATILE: { u16 val16; - int ret = cw1200_reg_read_16(priv, ST90TDS_CONFIG_REG_ID, &val16); + int ret = cw1200_reg_read_16(priv, + ST90TDS_CONFIG_REG_ID, + &val16); if (ret < 0) return ret; *val = val16; @@ -287,7 +289,9 @@ static int config_reg_write(struct cw1200_common *priv, u32 val) { switch (priv->hw_type) { case HIF_9000_SILICON_VERSATILE: - return cw1200_reg_write_16(priv, ST90TDS_CONFIG_REG_ID, (u16)val); + return cw1200_reg_write_16(priv, + ST90TDS_CONFIG_REG_ID, + (u16)val); case HIF_8601_VERSATILE: case HIF_8601_SILICON: default: @@ -326,7 +330,8 @@ int cw1200_load_firmware(struct cw1200_common *priv) } /* Set DPLL Reg value, and read back to confirm writes work */ - ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, cw1200_dpll_from_clk(priv->hw_refclk)); + ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, + cw1200_dpll_from_clk(priv->hw_refclk)); if (ret < 0) { pr_err("Can't write DPLL register.\n"); goto out; @@ -473,7 +478,8 @@ int cw1200_load_firmware(struct cw1200_common *priv) ret = cw1200_load_firmware_cw1200(priv); break; default: - pr_err("Can't perform firmware load for hw type %d.\n", priv->hw_type); + pr_err("Can't perform firmware load for hw type %d.\n", + priv->hw_type); ret = -ENOTSUPP; goto out; } diff --git a/drivers/net/wireless/cw1200/itp.h b/drivers/net/wireless/cw1200/itp.h index 521ed03..1e9dfb7 100644 --- a/drivers/net/wireless/cw1200/itp.h +++ b/drivers/net/wireless/cw1200/itp.h @@ -29,9 +29,6 @@ struct dentry; #define ITP_TIME_THRES_US 10000 #define ITP_US_TO_MS(x) ((x)/1000) #define ITP_MS_TO_US(x) ((x)*1000) -#if ((ITP_US_TO_MS(ITP_TIME_THRES_US))*HZ/1000) < 1 -#warning not able to achieve non-busywaiting ITP_TIME_THRES_US precision with current HZ value ! -#endif #define ITP_BUF_SIZE 255 diff --git a/drivers/net/wireless/cw1200/queue.c b/drivers/net/wireless/cw1200/queue.c index bb1f40b..0aeeb01 100644 --- a/drivers/net/wireless/cw1200/queue.c +++ b/drivers/net/wireless/cw1200/queue.c @@ -57,8 +57,8 @@ static inline void cw1200_queue_parse_id(u32 packet_id, u8 *queue_generation, *queue_generation = (packet_id >> 24) & 0xFF; } -static inline u32 cw1200_queue_make_packet_id(u8 queue_generation, u8 queue_id, - u8 item_generation, u8 item_id) +static inline u32 cw1200_queue_mk_packet_id(u8 queue_generation, u8 queue_id, + u8 item_generation, u8 item_id) { return ((u32)item_id << 0) | ((u32)item_generation << 8) | @@ -301,10 +301,10 @@ int cw1200_queue_put(struct cw1200_queue *queue, item->skb = skb; item->txpriv = *txpriv; item->generation = 0; - item->packet_id = cw1200_queue_make_packet_id(queue->generation, - queue->queue_id, - item->generation, - item - queue->pool); + item->packet_id = cw1200_queue_mk_packet_id(queue->generation, + queue->queue_id, + item->generation, + item - queue->pool); item->queue_timestamp = jiffies; ++queue->num_queued; @@ -405,10 +405,10 @@ int cw1200_queue_requeue(struct cw1200_queue *queue, u32 packet_id) spin_unlock_bh(&stats->lock); item->generation = ++item_generation; - item->packet_id = cw1200_queue_make_packet_id(queue_generation, - queue_id, - item_generation, - item_id); + item->packet_id = cw1200_queue_mk_packet_id(queue_generation, + queue_id, + item_generation, + item_id); list_move(&item->head, &queue->queue); } spin_unlock_bh(&queue->lock); diff --git a/drivers/net/wireless/cw1200/sta.c b/drivers/net/wireless/cw1200/sta.c index 388edb2..731945e 100644 --- a/drivers/net/wireless/cw1200/sta.c +++ b/drivers/net/wireless/cw1200/sta.c @@ -142,7 +142,8 @@ void cw1200_stop(struct ieee80211_hw *dev) atomic_xchg(&priv->tx_lock, 0); /* for recovery to work */ } -void __cw1200_cqm_bssloss_sm(struct cw1200_common *priv, int init, int good, int bad) +void __cw1200_cqm_bssloss_sm(struct cw1200_common *priv, + int init, int good, int bad) { int tx = 0; @@ -181,7 +182,7 @@ void __cw1200_cqm_bssloss_sm(struct cw1200_common *priv, int init, int good, int priv->bss_loss_state = 0; } - /* Spit out a NULL packet if necessary */ + /* Spit out a NULL packet to our AP if necessary */ if (tx) { struct sk_buff *skb; @@ -190,7 +191,7 @@ void __cw1200_cqm_bssloss_sm(struct cw1200_common *priv, int init, int good, int skb = ieee80211_nullfunc_get(priv->hw, priv->vif); WARN_ON(!skb); if (skb) - cw1200_tx(priv->hw, NULL, skb); /* Transmit NULL to AP */ + cw1200_tx(priv->hw, NULL, skb); } } @@ -340,7 +341,8 @@ int cw1200_config(struct ieee80211_hw *dev, u32 changed) pr_debug("[STA] Freq %d (wsm ch: %d).\n", ch->center_freq, ch->hw_value); - if (!__cw1200_flush(priv, false)) { /* Implicitly locks tx if successful */ + /* __cw1200_flush() implicitly locks tx, if successful */ + if (!__cw1200_flush(priv, false)) { if (!wsm_switch_channel(priv, &channel)) { ret = wait_event_timeout(priv->channel_switch_done, !priv->channel_switch_in_progress, @@ -352,6 +354,9 @@ int cw1200_config(struct ieee80211_hw *dev, u32 changed) } else { ret = -ETIMEDOUT; } + } else { + /* Unlock if switch channel fails */ + wsm_unlock_tx(priv); } } } @@ -619,7 +624,8 @@ int cw1200_conf_tx(struct ieee80211_hw *dev, struct ieee80211_vif *vif, } WSM_EDCA_SET(&priv->edca, queue, params->aifs, - params->cw_min, params->cw_max, params->txop, 0xc8, + params->cw_min, params->cw_max, + params->txop, 0xc8, params->uapsd); ret = wsm_set_edca_params(priv, &priv->edca); if (ret) { @@ -944,11 +950,6 @@ void cw1200_flush(struct ieee80211_hw *hw, bool drop) /* ******************************************************************** */ /* WSM callbacks */ -void cw1200_channel_switch_cb(struct cw1200_common *priv) -{ - wsm_unlock_tx(priv); -} - void cw1200_free_event_queue(struct cw1200_common *priv) { LIST_HEAD(list); @@ -987,9 +988,9 @@ void cw1200_event_handler(struct work_struct *work) * Scan complete will trigger bss_loss_work */ priv->delayed_link_loss = 1; - /* Also we're starting watchdog. */ + /* Also start a watchdog. */ queue_delayed_work(priv->workqueue, - &priv->bss_loss_work, 5 * HZ); + &priv->bss_loss_work, 5*HZ); } break; case WSM_EVENT_BSS_REGAINED: @@ -1087,15 +1088,15 @@ static int cw1200_parse_sdd_file(struct cw1200_common *priv) v = le16_to_cpu(*((u16 *)(p + 4))); priv->conf_listen_interval = (v >> 7) & 0x1F; - pr_debug("PTA found; Listen Interval %d\n", priv->conf_listen_interval); + pr_debug("PTA found; Listen Interval %d\n", + priv->conf_listen_interval); break; } case SDD_REFERENCE_FREQUENCY_ELT_ID: { u16 clk = le16_to_cpu(*((u16 *)(p + 2))); - if (clk != priv->hw_refclk) { + if (clk != priv->hw_refclk) pr_warn("SDD file doesn't match configured refclk (%d vs %d)\n", clk, priv->hw_refclk); - } break; } default: @@ -1192,7 +1193,8 @@ void cw1200_join_complete_work(struct work_struct *work) void cw1200_join_complete_cb(struct cw1200_common *priv, struct wsm_join_complete *arg) { - pr_debug("[STA] cw1200_join_complete_cb called, status=%d.\n", arg->status); + pr_debug("[STA] cw1200_join_complete_cb called, status=%d.\n", + arg->status); if (cancel_delayed_work(&priv->join_timeout)) { priv->join_complete_status = arg->status; @@ -1217,7 +1219,7 @@ static void cw1200_do_join(struct cw1200_common *priv) conf->basic_rates), }; if (delayed_work_pending(&priv->join_timeout)) { - pr_warn("[STA] Skipping join request - previous request yet to be completed\n"); + pr_warn("[STA] - Join request already pending, skipping..\n"); wsm_unlock_tx(priv); return; } @@ -1310,7 +1312,8 @@ static void cw1200_do_join(struct cw1200_common *priv) wsm_flush_tx(priv); /* Stay Awake for Join and Auth Timeouts and a bit more */ - cw1200_pm_stay_awake(&priv->pm_state, CW1200_JOIN_TIMEOUT + CW1200_AUTH_TIMEOUT); + cw1200_pm_stay_awake(&priv->pm_state, + CW1200_JOIN_TIMEOUT + CW1200_AUTH_TIMEOUT); cw1200_update_listening(priv, false); diff --git a/drivers/net/wireless/cw1200/sta.h b/drivers/net/wireless/cw1200/sta.h index 115047a..26eb436 100644 --- a/drivers/net/wireless/cw1200/sta.h +++ b/drivers/net/wireless/cw1200/sta.h @@ -54,7 +54,6 @@ int cw1200_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg); /* ******************************************************************** */ /* WSM callbacks */ -void cw1200_channel_switch_cb(struct cw1200_common *priv); void cw1200_join_complete_cb(struct cw1200_common *priv, struct wsm_join_complete *arg); diff --git a/drivers/net/wireless/cw1200/wsm.c b/drivers/net/wireless/cw1200/wsm.c index 8fe6442..1667944 100644 --- a/drivers/net/wireless/cw1200/wsm.c +++ b/drivers/net/wireless/cw1200/wsm.c @@ -960,7 +960,7 @@ static int wsm_channel_switch_indication(struct cw1200_common *priv, priv->channel_switch_in_progress = 0; wake_up(&priv->channel_switch_done); - cw1200_channel_switch_cb(priv); + wsm_unlock_tx(priv); return 0;