aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-hcmd.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/iwlwifi/iwl-hcmd.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-hcmd.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index a6856daf14cb..73681c4fefe7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
@@ -56,7 +56,8 @@ const char *get_cmd_string(u8 cmd)
56 IWL_CMD(REPLY_LEDS_CMD); 56 IWL_CMD(REPLY_LEDS_CMD);
57 IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); 57 IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
58 IWL_CMD(COEX_PRIORITY_TABLE_CMD); 58 IWL_CMD(COEX_PRIORITY_TABLE_CMD);
59 IWL_CMD(RADAR_NOTIFICATION); 59 IWL_CMD(COEX_MEDIUM_NOTIFICATION);
60 IWL_CMD(COEX_EVENT_CMD);
60 IWL_CMD(REPLY_QUIET_CMD); 61 IWL_CMD(REPLY_QUIET_CMD);
61 IWL_CMD(REPLY_CHANNEL_SWITCH); 62 IWL_CMD(REPLY_CHANNEL_SWITCH);
62 IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); 63 IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
@@ -93,6 +94,8 @@ const char *get_cmd_string(u8 cmd)
93 IWL_CMD(CALIBRATION_RES_NOTIFICATION); 94 IWL_CMD(CALIBRATION_RES_NOTIFICATION);
94 IWL_CMD(CALIBRATION_COMPLETE_NOTIFICATION); 95 IWL_CMD(CALIBRATION_COMPLETE_NOTIFICATION);
95 IWL_CMD(REPLY_TX_POWER_DBM_CMD); 96 IWL_CMD(REPLY_TX_POWER_DBM_CMD);
97 IWL_CMD(TEMPERATURE_NOTIFICATION);
98 IWL_CMD(TX_ANT_CONFIGURATION_CMD);
96 default: 99 default:
97 return "UNKNOWN"; 100 return "UNKNOWN";
98 101
@@ -104,17 +107,8 @@ EXPORT_SYMBOL(get_cmd_string);
104 107
105static void iwl_generic_cmd_callback(struct iwl_priv *priv, 108static void iwl_generic_cmd_callback(struct iwl_priv *priv,
106 struct iwl_device_cmd *cmd, 109 struct iwl_device_cmd *cmd,
107 struct sk_buff *skb) 110 struct iwl_rx_packet *pkt)
108{ 111{
109 struct iwl_rx_packet *pkt = NULL;
110
111 if (!skb) {
112 IWL_ERR(priv, "Error: Response NULL in %s.\n",
113 get_cmd_string(cmd->hdr.cmd));
114 return;
115 }
116
117 pkt = (struct iwl_rx_packet *)skb->data;
118 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 112 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
119 IWL_ERR(priv, "Bad return from %s (0x%08X)\n", 113 IWL_ERR(priv, "Bad return from %s (0x%08X)\n",
120 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 114 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
@@ -170,15 +164,13 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
170 /* A synchronous command can not have a callback set. */ 164 /* A synchronous command can not have a callback set. */
171 BUG_ON(cmd->callback); 165 BUG_ON(cmd->callback);
172 166
173 if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) { 167 IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
174 IWL_ERR(priv,
175 "Error sending %s: Already sending a host command\n",
176 get_cmd_string(cmd->id)); 168 get_cmd_string(cmd->id));
177 ret = -EBUSY; 169 mutex_lock(&priv->sync_cmd_mutex);
178 goto out;
179 }
180 170
181 set_bit(STATUS_HCMD_ACTIVE, &priv->status); 171 set_bit(STATUS_HCMD_ACTIVE, &priv->status);
172 IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s \n",
173 get_cmd_string(cmd->id));
182 174
183 cmd_idx = iwl_enqueue_hcmd(priv, cmd); 175 cmd_idx = iwl_enqueue_hcmd(priv, cmd);
184 if (cmd_idx < 0) { 176 if (cmd_idx < 0) {
@@ -199,24 +191,26 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
199 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); 191 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
200 192
201 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 193 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
194 IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s \n",
195 get_cmd_string(cmd->id));
202 ret = -ETIMEDOUT; 196 ret = -ETIMEDOUT;
203 goto cancel; 197 goto cancel;
204 } 198 }
205 } 199 }
206 200
207 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { 201 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
208 IWL_DEBUG_INFO(priv, "Command %s aborted: RF KILL Switch\n", 202 IWL_ERR(priv, "Command %s aborted: RF KILL Switch\n",
209 get_cmd_string(cmd->id)); 203 get_cmd_string(cmd->id));
210 ret = -ECANCELED; 204 ret = -ECANCELED;
211 goto fail; 205 goto fail;
212 } 206 }
213 if (test_bit(STATUS_FW_ERROR, &priv->status)) { 207 if (test_bit(STATUS_FW_ERROR, &priv->status)) {
214 IWL_DEBUG_INFO(priv, "Command %s failed: FW Error\n", 208 IWL_ERR(priv, "Command %s failed: FW Error\n",
215 get_cmd_string(cmd->id)); 209 get_cmd_string(cmd->id));
216 ret = -EIO; 210 ret = -EIO;
217 goto fail; 211 goto fail;
218 } 212 }
219 if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_skb) { 213 if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) {
220 IWL_ERR(priv, "Error: Response NULL in '%s'\n", 214 IWL_ERR(priv, "Error: Response NULL in '%s'\n",
221 get_cmd_string(cmd->id)); 215 get_cmd_string(cmd->id));
222 ret = -EIO; 216 ret = -EIO;
@@ -238,12 +232,12 @@ cancel:
238 ~CMD_WANT_SKB; 232 ~CMD_WANT_SKB;
239 } 233 }
240fail: 234fail:
241 if (cmd->reply_skb) { 235 if (cmd->reply_page) {
242 dev_kfree_skb_any(cmd->reply_skb); 236 iwl_free_pages(priv, cmd->reply_page);
243 cmd->reply_skb = NULL; 237 cmd->reply_page = 0;
244 } 238 }
245out: 239out:
246 clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status); 240 mutex_unlock(&priv->sync_cmd_mutex);
247 return ret; 241 return ret;
248} 242}
249EXPORT_SYMBOL(iwl_send_cmd_sync); 243EXPORT_SYMBOL(iwl_send_cmd_sync);
@@ -273,7 +267,7 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
273 u8 id, u16 len, const void *data, 267 u8 id, u16 len, const void *data,
274 void (*callback)(struct iwl_priv *priv, 268 void (*callback)(struct iwl_priv *priv,
275 struct iwl_device_cmd *cmd, 269 struct iwl_device_cmd *cmd,
276 struct sk_buff *skb)) 270 struct iwl_rx_packet *pkt))
277{ 271{
278 struct iwl_host_cmd cmd = { 272 struct iwl_host_cmd cmd = {
279 .id = id, 273 .id = id,