aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-09-20 18:37:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-21 16:19:42 -0400
commit247c61d625154e18a105d663281c52376a882762 (patch)
treeec06a3824fda8a119cef3f7338826b4d25eee656 /drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
parent390808db4ab5c658dc1eb8078d82027ce7d0ea78 (diff)
iwlagn: remove the callback in host commands
Before this patch, the upper layer could register a callback for each host command. This mechanism allowed the upper layer to have different callbacks for the same command ID. In fact, it wasn't used and the rx_handlers is enough: same callback for all the command with a specific command ID. The iwl_send_add_station needs the access the command that was sent while handling the response (regardless if the command was sent in SYNC or ASYNC mode). So now, all the handlers receive the host command that was sent. This implies a change in the handler signature. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index 031a291a13dc..48ef6c25d5bc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -762,8 +762,6 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
762 memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ 762 memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */
763 if (cmd->flags & CMD_WANT_SKB) 763 if (cmd->flags & CMD_WANT_SKB)
764 out_meta->source = cmd; 764 out_meta->source = cmd;
765 if (cmd->flags & CMD_ASYNC)
766 out_meta->callback = cmd->callback;
767 765
768 /* set up the header */ 766 /* set up the header */
769 767
@@ -894,12 +892,15 @@ static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
894/** 892/**
895 * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them 893 * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
896 * @rxb: Rx buffer to reclaim 894 * @rxb: Rx buffer to reclaim
895 * @handler_status: return value of the handler of the command
896 * (put in setup_rx_handlers)
897 * 897 *
898 * If an Rx buffer has an async callback associated with it the callback 898 * If an Rx buffer has an async callback associated with it the callback
899 * will be executed. The attached skb (if present) will only be freed 899 * will be executed. The attached skb (if present) will only be freed
900 * if the callback returns 1 900 * if the callback returns 1
901 */ 901 */
902void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb) 902void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb,
903 int handler_status)
903{ 904{
904 struct iwl_rx_packet *pkt = rxb_addr(rxb); 905 struct iwl_rx_packet *pkt = rxb_addr(rxb);
905 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 906 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
@@ -936,9 +937,9 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb)
936 /* Input error checking is done when commands are added to queue. */ 937 /* Input error checking is done when commands are added to queue. */
937 if (meta->flags & CMD_WANT_SKB) { 938 if (meta->flags & CMD_WANT_SKB) {
938 meta->source->reply_page = (unsigned long)rxb_addr(rxb); 939 meta->source->reply_page = (unsigned long)rxb_addr(rxb);
940 meta->source->handler_status = handler_status;
939 rxb->page = NULL; 941 rxb->page = NULL;
940 } else if (meta->callback) 942 }
941 meta->callback(trans->shrd, cmd, pkt);
942 943
943 spin_lock_irqsave(&trans->hcmd_lock, flags); 944 spin_lock_irqsave(&trans->hcmd_lock, flags);
944 945
@@ -958,30 +959,6 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb)
958 959
959#define HOST_COMPLETE_TIMEOUT (2 * HZ) 960#define HOST_COMPLETE_TIMEOUT (2 * HZ)
960 961
961static void iwl_generic_cmd_callback(struct iwl_shared *shrd,
962 struct iwl_device_cmd *cmd,
963 struct iwl_rx_packet *pkt)
964{
965 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
966 IWL_ERR(shrd->trans, "Bad return from %s (0x%08X)\n",
967 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
968 return;
969 }
970
971#ifdef CONFIG_IWLWIFI_DEBUG
972 switch (cmd->hdr.cmd) {
973 case REPLY_TX_LINK_QUALITY_CMD:
974 case SENSITIVITY_CMD:
975 IWL_DEBUG_HC_DUMP(shrd->trans, "back from %s (0x%08X)\n",
976 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
977 break;
978 default:
979 IWL_DEBUG_HC(shrd->trans, "back from %s (0x%08X)\n",
980 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
981 }
982#endif
983}
984
985static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd) 962static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
986{ 963{
987 int ret; 964 int ret;
@@ -990,9 +967,6 @@ static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
990 if (WARN_ON(cmd->flags & CMD_WANT_SKB)) 967 if (WARN_ON(cmd->flags & CMD_WANT_SKB))
991 return -EINVAL; 968 return -EINVAL;
992 969
993 /* Assign a generic callback if one is not provided */
994 if (!cmd->callback)
995 cmd->callback = iwl_generic_cmd_callback;
996 970
997 if (test_bit(STATUS_EXIT_PENDING, &trans->shrd->status)) 971 if (test_bit(STATUS_EXIT_PENDING, &trans->shrd->status))
998 return -EBUSY; 972 return -EBUSY;
@@ -1014,10 +988,6 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
1014 988
1015 lockdep_assert_held(&trans->shrd->mutex); 989 lockdep_assert_held(&trans->shrd->mutex);
1016 990
1017 /* A synchronous command can not have a callback set. */
1018 if (WARN_ON(cmd->callback))
1019 return -EINVAL;
1020
1021 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", 991 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n",
1022 get_cmd_string(cmd->id)); 992 get_cmd_string(cmd->id));
1023 993