From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
Johannes Berg <johannes.berg@intel.com>,
Wey-Yi Guy <wey-yi.w.guy@intel.com>
Subject: [PATCH 004/101] iwlwifi: simplify code in iwlagn_key_sta_id
Date: Sun, 4 Mar 2012 11:28:18 -0800 [thread overview]
Message-ID: <1330889395-533-5-git-send-email-wey-yi.w.guy@intel.com> (raw)
In-Reply-To: <1330889395-533-1-git-send-email-wey-yi.w.guy@intel.com>
From: Johannes Berg <johannes.berg@intel.com>
Simplify the code by returning directly in the
error case and replacing the switch/if with a
single if statement.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 21 ++++-----------------
1 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index f1298cd..3eb8fd4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -1080,32 +1080,19 @@ static u8 iwlagn_key_sta_id(struct iwl_priv *priv,
struct ieee80211_sta *sta)
{
struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
- u8 sta_id = IWL_INVALID_STATION;
if (sta)
- sta_id = iwl_sta_id(sta);
+ return iwl_sta_id(sta);
/*
* The device expects GTKs for station interfaces to be
* installed as GTKs for the AP station. If we have no
* station ID, then use the ap_sta_id in that case.
*/
- if (!sta && vif && vif_priv->ctx) {
- switch (vif->type) {
- case NL80211_IFTYPE_STATION:
- sta_id = vif_priv->ctx->ap_sta_id;
- break;
- default:
- /*
- * In all other cases, the key will be
- * used either for TX only or is bound
- * to a station already.
- */
- break;
- }
- }
+ if (vif->type == NL80211_IFTYPE_STATION && vif_priv->ctx)
+ return vif_priv->ctx->ap_sta_id;
- return sta_id;
+ return IWL_INVALID_STATION;
}
static int iwlagn_send_sta_key(struct iwl_priv *priv,
--
1.7.0.4
next prev parent reply other threads:[~2012-03-04 20:42 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-04 19:28 [PATCH 000/101] update for 3.4: iwlwifi 2012-03-04 Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 001/101] iwlwifi: move iwl_clear_driver_stations to user Wey-Yi Guy
2012-03-05 1:32 ` David Miller
2012-03-05 0:37 ` Guy, Wey-Yi
2012-03-05 19:59 ` John W. Linville
2012-03-04 19:28 ` [PATCH 002/101] iwlwifi: remove an unused argument Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 003/101] iwlwifi: reduce sta_lock hold time in TX Wey-Yi Guy
2012-03-04 19:28 ` Wey-Yi Guy [this message]
2012-03-04 19:28 ` [PATCH 005/101] iwlwifi: build some station commands directly Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 006/101] iwlwifi: introduce per-queue locks Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 007/101] iwlwifi: make sta lock private & BH lock Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 008/101] iwlwifi: introduce statistics lock Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 009/101] iwlwifi: remove shared lock Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 010/101] iwlwifi: make EXIT_PENDING depend on mac80211 Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 011/101] iwlwifi: simplify auth/assoc flow Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 012/101] iwlwifi: remove per-device debug level Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 013/101] iwlwifi: remove SKU from config Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 014/101] iwlwifi: use valid TX/RX antenna from hw_params Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 015/101] iwlwifi: make config const Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 016/101] iwlwifi: reduce IDI code ifdef Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 017/101] iwlwifi: clean up (wowlan) suspend flow Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 018/101] iwlwifi: move wowlan bool into priv Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 019/101] iwlwifi: use ieee80211_tx_status Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 020/101] iwlwifi: pass response packet directly Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 021/101] iwlwifi: don't pass iwl_rx_mem_buffer to upper layers Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 022/101] iwlwifi: refactor PCI-E RX path Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 023/101] iwlwifi: transport's tx_agg_alloc must not sleep Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 024/101] iwlwifi: move queue functions to PCI-E Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 025/101] iwlwifi: iwl_rx_cmd_buffer belongs to transport API Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 026/101] iwlwifi: move tid_to_ac to PCI-E Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 027/101] iwlwifi: move IWL_MASK into file using it Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 028/101] iwlwifi: move traffic log definitions Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 029/101] iwlwifi: fix station HT parameters Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 030/101] iwlwifi: move uCode deallocation to drv Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 031/101] iwlwifi: move iwl_base_params to shared header Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 032/101] iwlwifi: move firmware request into drv Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 033/101] iwlwifi: move firmware completion wait Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 034/101] iwlwifi: move ucode loading to op_mode Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 035/101] iwlwifi: split out firmware store Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 036/101] iwlwifi: remove iwl-wifi.h Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 037/101] iwlwifi: add wrappers for command sending Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 038/101] iwlwifi: move RF/CT kill check to command wrapper Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 039/101] iwlwifi: move lockdep assertion into DVM Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 040/101] iwlwifi: move mutex out of shared Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 041/101] iwlwifi: move rfkill status handling out of transport Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 042/101] iwlwifi: rename ucode.h to fw-file.h Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 043/101] iwlwifi: remove AMT check from transport Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 044/101] iwlwifi: remove shadow_reg_enable from hw_params Wey-Yi Guy
2012-03-04 19:28 ` [PATCH 045/101] iwlwifi: move status check functions out of shared Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 046/101] iwlwifi: make tracing use device as identifier Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 047/101] iwlwifi: virtualize command queue full behaviour Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 048/101] iwlwifi: clean up iwl-core.h inclusions Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 049/101] iwlwifi: remove num_of_queues module parameter Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 050/101] iwlwifi: remove max_txq_num from hw_params Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 051/101] iwlwifi: keep plcp_delta_threshold in priv Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 052/101] iwlwifi: use watchdog timeout from hw_params Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 053/101] iwlwifi: put use_rts_for_aggregation into hw_params Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 054/101] iwlwifi: constify remaining config data Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 055/101] iwlwifi: fix notification wait bug Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 056/101] iwlwifi: abstract out notification wait support Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 057/101] iwlwifi: move ucode_owner to priv Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 058/101] iwlwifi: move all uCode load variables Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 059/101] iwlwifi: move irq to PCIe Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 060/101] iwlwifi: move packet to transport Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 061/101] iwlwifi: virtualize nic_config Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 062/101] iwlwifi: remove priv from shared Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 063/101] iwlwifi: remove PA type configuration Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 064/101] iwlwifi: don't include iwl-prph.h everywhere Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 065/101] iwlwifi: clean up iwl-commands.h Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 066/101] iwlwifi: make iwl_fill_probe_req static Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 067/101] iwlwifi: remove unused arguments from iwlagn_gain_computation Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 068/101] iwlwifi: remove unused argument from rs_initialize_lq Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 069/101] iwlwifi: move iwl_sta_id_or_broadcast to user Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 070/101] iwlwifi: remove unused argument from iwl_init_hw_rates Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 071/101] iwlwifi: remove two unused arguments in testmode Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 072/101] iwlwifi: remove unused argument from iwlagn_suspend Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 073/101] iwlwifi: redesign PASSIVE_NO_RX workaround Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 074/101] iwlwifi: transport's tx_agg_disable must be atomic Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 075/101] iwlwifi: remove BT handlers from lib_ops Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 076/101] iwlwifi: move BT/HT params to shared Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 077/101] iwlwifi: make EEPROM enhanced TX power a bool Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 078/101] iwlwifi: remove unused max_nrg_cck from sensitivity and constify Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 079/101] iwlwifi: return error if loading uCode failed Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 080/101] iwlwifi: dump stack when fail to gain access to the device Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 081/101] iwlwifi: always check if got h/w access before write Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 082/101] iwlwifi: cleanup/fix memory barriers Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 083/101] iwlwifi: use writeb,writel,readl directly Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 084/101] iwlwifi: print DMA stop timeout error only if it happened Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 085/101] iwlwifi: reintroduce iwl_enable_rfkill_int Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 086/101] iwlwifi: add testmode command for rx forwarding Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 087/101] iwlwifi: fixed testmode notifications length Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 088/101] iwlwifi: add option to test MFP Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 089/101] iwlwifi: separate status to priv and trans Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 090/101] iwlwifi: make tx_cmd_pool kmem cache global Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 091/101] iwlwifi: log stop / wake queues Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 092/101] iwlwifi: configure transport layer from dvm op mode Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 093/101] iwlwifi: move setting up fw parameters Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 094/101] iwlwifi: more status bit factoring Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 095/101] iwlwifi: move command queue number out of the iwl_shared struct Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 096/101] iwlwifi: remove messages from queue wake/stop Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 097/101] iwlwifi: make iwl_init_context static Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 098/101] iwlwifi: restore PAN support Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 099/101] iwlwifi: don't delete AP station directly Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 100/101] iwlwifi: correct status bit refactoring errors Wey-Yi Guy
2012-03-04 19:29 ` [PATCH 101/101] iwlwifi: always monitor for stuck queues Wey-Yi Guy
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=1330889395-533-5-git-send-email-wey-yi.w.guy@intel.com \
--to=wey-yi.w.guy@intel.com \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).