From: Nicholas Mc Guire <hofrat@osadl.org> To: Kalle Valo <kvalo@qca.qualcomm.com> Cc: Valdis.Kletnieks@vt.edu, Bj??rn Mork <bjorn@mork.no>, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire <hofrat@osadl.org> Subject: [PATCH 1/2 RFC] ath10k: move code out of the parameter list Date: Wed, 11 Mar 2015 13:19:29 -0400 [thread overview] Message-ID: <1426094369-10213-1-git-send-email-hofrat@osadl.org> (raw) Putting code into the parameter list of wait_event_timeout() might be legal C-code but not really readable - the "inline" code is simply moved into a function and that passed to wait_event_timeout() as the condition. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> --- Thanks to Bjorn Mork <bjorn@mork.no> for clarifying my initial confusion ! Patch was only compile tested with x86_64_defconfig + CONFIG_ATH_CARDS=m, CONFIG_ATH10K=m Patch is against 4.0-rc3 (localversion-next is -next-20150311) drivers/net/wireless/ath/ath10k/mac.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index e8cc19f..7b27d99 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4463,11 +4463,25 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) return ret; } +static bool check_htt_state(struct ath10k *ar, bool skip) +{ + bool empty; + + spin_lock_bh(&ar->htt.tx_lock); + empty = (ar->htt.num_pending_tx == 0); + spin_unlock_bh(&ar->htt.tx_lock); + + skip = (ar->state == ATH10K_STATE_WEDGED) || + test_bit(ATH10K_FLAG_CRASH_FLUSH, + &ar->dev_flags); + return (empty || skip); +} + static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop) { struct ath10k *ar = hw->priv; - bool skip; + bool skip = false; int ret; /* mac80211 doesn't care if we really xmit queued frames or not @@ -4480,19 +4494,9 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (ar->state == ATH10K_STATE_WEDGED) goto skip; - ret = wait_event_timeout(ar->htt.empty_tx_wq, ({ - bool empty; - - spin_lock_bh(&ar->htt.tx_lock); - empty = (ar->htt.num_pending_tx == 0); - spin_unlock_bh(&ar->htt.tx_lock); - - skip = (ar->state == ATH10K_STATE_WEDGED) || - test_bit(ATH10K_FLAG_CRASH_FLUSH, - &ar->dev_flags); - - (empty || skip); - }), ATH10K_FLUSH_TIMEOUT_HZ); + ret = wait_event_timeout(ar->htt.empty_tx_wq, + check_htt_state(ar, skip), + ATH10K_FLUSH_TIMEOUT_HZ); if (ret <= 0 || skip) ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %i\n", -- 1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Mc Guire <hofrat@osadl.org> To: Kalle Valo <kvalo@qca.qualcomm.com> Cc: Valdis.Kletnieks@vt.edu, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org, Nicholas Mc Guire <hofrat@osadl.org>, Bj??rn Mork <bjorn@mork.no> Subject: [PATCH 1/2 RFC] ath10k: move code out of the parameter list Date: Wed, 11 Mar 2015 13:19:29 -0400 [thread overview] Message-ID: <1426094369-10213-1-git-send-email-hofrat@osadl.org> (raw) Putting code into the parameter list of wait_event_timeout() might be legal C-code but not really readable - the "inline" code is simply moved into a function and that passed to wait_event_timeout() as the condition. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> --- Thanks to Bjorn Mork <bjorn@mork.no> for clarifying my initial confusion ! Patch was only compile tested with x86_64_defconfig + CONFIG_ATH_CARDS=m, CONFIG_ATH10K=m Patch is against 4.0-rc3 (localversion-next is -next-20150311) drivers/net/wireless/ath/ath10k/mac.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index e8cc19f..7b27d99 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4463,11 +4463,25 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) return ret; } +static bool check_htt_state(struct ath10k *ar, bool skip) +{ + bool empty; + + spin_lock_bh(&ar->htt.tx_lock); + empty = (ar->htt.num_pending_tx == 0); + spin_unlock_bh(&ar->htt.tx_lock); + + skip = (ar->state == ATH10K_STATE_WEDGED) || + test_bit(ATH10K_FLAG_CRASH_FLUSH, + &ar->dev_flags); + return (empty || skip); +} + static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop) { struct ath10k *ar = hw->priv; - bool skip; + bool skip = false; int ret; /* mac80211 doesn't care if we really xmit queued frames or not @@ -4480,19 +4494,9 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (ar->state == ATH10K_STATE_WEDGED) goto skip; - ret = wait_event_timeout(ar->htt.empty_tx_wq, ({ - bool empty; - - spin_lock_bh(&ar->htt.tx_lock); - empty = (ar->htt.num_pending_tx == 0); - spin_unlock_bh(&ar->htt.tx_lock); - - skip = (ar->state == ATH10K_STATE_WEDGED) || - test_bit(ATH10K_FLAG_CRASH_FLUSH, - &ar->dev_flags); - - (empty || skip); - }), ATH10K_FLUSH_TIMEOUT_HZ); + ret = wait_event_timeout(ar->htt.empty_tx_wq, + check_htt_state(ar, skip), + ATH10K_FLUSH_TIMEOUT_HZ); if (ret <= 0 || skip) ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %i\n", -- 1.7.10.4 _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k
next reply other threads:[~2015-03-11 17:24 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-11 17:19 Nicholas Mc Guire [this message] 2015-03-11 17:19 ` [PATCH 1/2 RFC] ath10k: move code out of the parameter list Nicholas Mc Guire 2015-03-11 17:41 ` Pat Erley 2015-03-11 17:41 ` Pat Erley 2015-03-11 18:13 ` Nicholas Mc Guire 2015-03-11 18:13 ` Nicholas Mc Guire 2015-03-11 18:09 ` Bjørn Mork 2015-03-11 18:09 ` Bjørn Mork 2015-03-11 18:26 ` Nicholas Mc Guire 2015-03-11 18:26 ` Nicholas Mc Guire
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1426094369-10213-1-git-send-email-hofrat@osadl.org \ --to=hofrat@osadl.org \ --cc=Valdis.Kletnieks@vt.edu \ --cc=ath10k@lists.infradead.org \ --cc=bjorn@mork.no \ --cc=kvalo@qca.qualcomm.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-wireless@vger.kernel.org \ --cc=netdev@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.