diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-02-25 14:50:53 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-03-09 13:16:46 -0400 |
commit | 14cfca7152ae5d10b15baf01c7fd60f0f0871062 (patch) | |
tree | 64cd286b5370b0a50242fc1e20dc16b42a962090 /drivers | |
parent | a812cba9bb141225ce28a48b60038e115620bccd (diff) |
iwlwifi: return whether to stop from rfkill method
When indicating RF-kill toggle to the higher layer, that
may in turn call back to the transport (for MVM at least)
to turn off the device quickly. Instead of that, allow it
to return whether or not the device should be turned off,
this gets rid of the call indirection and will help make
the API more consistent when we go back to non-threaded
interrupts again for PCIe.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/dvm/main.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-op-mode.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/ops.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/drv.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/internal.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/rx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/trans.c | 12 |
7 files changed, 25 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index ba1b1ea54252..4a5cacce143e 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c | |||
@@ -2035,7 +2035,7 @@ static void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) | |||
2035 | ieee80211_free_txskb(priv->hw, skb); | 2035 | ieee80211_free_txskb(priv->hw, skb); |
2036 | } | 2036 | } |
2037 | 2037 | ||
2038 | static void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | 2038 | static bool iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) |
2039 | { | 2039 | { |
2040 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); | 2040 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); |
2041 | 2041 | ||
@@ -2045,6 +2045,8 @@ static void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | |||
2045 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2045 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
2046 | 2046 | ||
2047 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, state); | 2047 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, state); |
2048 | |||
2049 | return false; | ||
2048 | } | 2050 | } |
2049 | 2051 | ||
2050 | static const struct iwl_op_mode_ops iwl_dvm_ops = { | 2052 | static const struct iwl_op_mode_ops iwl_dvm_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h index 5d78207040b0..ea29504ac617 100644 --- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h | |||
@@ -119,7 +119,8 @@ struct iwl_cfg; | |||
119 | * @queue_not_full: notifies that a HW queue is not full any more. | 119 | * @queue_not_full: notifies that a HW queue is not full any more. |
120 | * Must be atomic and called with BH disabled. | 120 | * Must be atomic and called with BH disabled. |
121 | * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that | 121 | * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that |
122 | * the radio is killed. May sleep. | 122 | * the radio is killed. Return %true if the device should be stopped by |
123 | * the transport immediately after the call. May sleep. | ||
123 | * @free_skb: allows the transport layer to free skbs that haven't been | 124 | * @free_skb: allows the transport layer to free skbs that haven't been |
124 | * reclaimed by the op_mode. This can happen when the driver is freed and | 125 | * reclaimed by the op_mode. This can happen when the driver is freed and |
125 | * there are Tx packets pending in the transport layer. | 126 | * there are Tx packets pending in the transport layer. |
@@ -144,7 +145,7 @@ struct iwl_op_mode_ops { | |||
144 | struct iwl_device_cmd *cmd); | 145 | struct iwl_device_cmd *cmd); |
145 | void (*queue_full)(struct iwl_op_mode *op_mode, int queue); | 146 | void (*queue_full)(struct iwl_op_mode *op_mode, int queue); |
146 | void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue); | 147 | void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue); |
147 | void (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state); | 148 | bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state); |
148 | void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb); | 149 | void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb); |
149 | void (*nic_error)(struct iwl_op_mode *op_mode); | 150 | void (*nic_error)(struct iwl_op_mode *op_mode); |
150 | void (*cmd_queue_full)(struct iwl_op_mode *op_mode); | 151 | void (*cmd_queue_full)(struct iwl_op_mode *op_mode); |
@@ -195,11 +196,11 @@ static inline void iwl_op_mode_queue_not_full(struct iwl_op_mode *op_mode, | |||
195 | op_mode->ops->queue_not_full(op_mode, queue); | 196 | op_mode->ops->queue_not_full(op_mode, queue); |
196 | } | 197 | } |
197 | 198 | ||
198 | static inline void iwl_op_mode_hw_rf_kill(struct iwl_op_mode *op_mode, | 199 | static inline bool __must_check |
199 | bool state) | 200 | iwl_op_mode_hw_rf_kill(struct iwl_op_mode *op_mode, bool state) |
200 | { | 201 | { |
201 | might_sleep(); | 202 | might_sleep(); |
202 | op_mode->ops->hw_rf_kill(op_mode, state); | 203 | return op_mode->ops->hw_rf_kill(op_mode, state); |
203 | } | 204 | } |
204 | 205 | ||
205 | static inline void iwl_op_mode_free_skb(struct iwl_op_mode *op_mode, | 206 | static inline void iwl_op_mode_free_skb(struct iwl_op_mode *op_mode, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index ae347fb16a5d..05f635572063 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -690,7 +690,7 @@ void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state) | |||
690 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); | 690 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); |
691 | } | 691 | } |
692 | 692 | ||
693 | static void iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | 693 | static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) |
694 | { | 694 | { |
695 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | 695 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); |
696 | 696 | ||
@@ -699,9 +699,9 @@ static void iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | |||
699 | else | 699 | else |
700 | clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); | 700 | clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); |
701 | 701 | ||
702 | if (state && mvm->cur_ucode != IWL_UCODE_INIT) | ||
703 | iwl_trans_stop_device(mvm->trans); | ||
704 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); | 702 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); |
703 | |||
704 | return state && mvm->cur_ucode != IWL_UCODE_INIT; | ||
705 | } | 705 | } |
706 | 706 | ||
707 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) | 707 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 22b6b7ee5fd2..e530055019ce 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -561,7 +561,7 @@ static int iwl_pci_resume(struct device *device) | |||
561 | iwl_enable_rfkill_int(trans); | 561 | iwl_enable_rfkill_int(trans); |
562 | 562 | ||
563 | hw_rfkill = iwl_is_rfkill_set(trans); | 563 | hw_rfkill = iwl_is_rfkill_set(trans); |
564 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 564 | iwl_trans_pcie_rf_kill(trans, hw_rfkill); |
565 | 565 | ||
566 | return 0; | 566 | return 0; |
567 | } | 567 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index 3120bc5bb12d..9091513ea738 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -488,4 +488,6 @@ static inline void __iwl_trans_pcie_set_bit(struct iwl_trans *trans, | |||
488 | __iwl_trans_pcie_set_bits_mask(trans, reg, mask, mask); | 488 | __iwl_trans_pcie_set_bits_mask(trans, reg, mask, mask); |
489 | } | 489 | } |
490 | 490 | ||
491 | void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); | ||
492 | |||
491 | #endif /* __iwl_trans_int_pcie_h__ */ | 493 | #endif /* __iwl_trans_int_pcie_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index cf49f6ce0ff8..fdfa3969cac9 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -994,7 +994,7 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
994 | 994 | ||
995 | isr_stats->rfkill++; | 995 | isr_stats->rfkill++; |
996 | 996 | ||
997 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 997 | iwl_trans_pcie_rf_kill(trans, hw_rfkill); |
998 | if (hw_rfkill) { | 998 | if (hw_rfkill) { |
999 | set_bit(STATUS_RFKILL, &trans->status); | 999 | set_bit(STATUS_RFKILL, &trans->status); |
1000 | if (test_and_clear_bit(STATUS_SYNC_HCMD_ACTIVE, | 1000 | if (test_and_clear_bit(STATUS_SYNC_HCMD_ACTIVE, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 32a5a9a20811..dcfd6d866d09 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -770,7 +770,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
770 | set_bit(STATUS_RFKILL, &trans->status); | 770 | set_bit(STATUS_RFKILL, &trans->status); |
771 | else | 771 | else |
772 | clear_bit(STATUS_RFKILL, &trans->status); | 772 | clear_bit(STATUS_RFKILL, &trans->status); |
773 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 773 | iwl_trans_pcie_rf_kill(trans, hw_rfkill); |
774 | if (hw_rfkill && !run_in_rfkill) | 774 | if (hw_rfkill && !run_in_rfkill) |
775 | return -ERFKILL; | 775 | return -ERFKILL; |
776 | 776 | ||
@@ -885,7 +885,13 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
885 | else | 885 | else |
886 | clear_bit(STATUS_RFKILL, &trans->status); | 886 | clear_bit(STATUS_RFKILL, &trans->status); |
887 | if (hw_rfkill != was_hw_rfkill) | 887 | if (hw_rfkill != was_hw_rfkill) |
888 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 888 | iwl_trans_pcie_rf_kill(trans, hw_rfkill); |
889 | } | ||
890 | |||
891 | void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state) | ||
892 | { | ||
893 | if (iwl_op_mode_hw_rf_kill(trans->op_mode, state)) | ||
894 | iwl_trans_pcie_stop_device(trans); | ||
889 | } | 895 | } |
890 | 896 | ||
891 | static void iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test) | 897 | static void iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test) |
@@ -994,7 +1000,7 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
994 | set_bit(STATUS_RFKILL, &trans->status); | 1000 | set_bit(STATUS_RFKILL, &trans->status); |
995 | else | 1001 | else |
996 | clear_bit(STATUS_RFKILL, &trans->status); | 1002 | clear_bit(STATUS_RFKILL, &trans->status); |
997 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 1003 | iwl_trans_pcie_rf_kill(trans, hw_rfkill); |
998 | 1004 | ||
999 | return 0; | 1005 | return 0; |
1000 | } | 1006 | } |