diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-03-25 19:33:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-27 16:03:18 -0400 |
commit | 0472f887e0689fff2dce82c01d40698432965b5a (patch) | |
tree | f85700dc5f68ac1883aa073b749058f4547ee2d9 /drivers/net/wireless/iwlwifi | |
parent | 24709182754625829e499b5d628affa881d1dba0 (diff) |
iwlwifi: allow a default callback for ASYNC host commands
This patch provides a default callback for ASYNC host commands instead
of calling to BUG_ON. Most of the callbacks are now just empty functions
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-hcmd.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 559ff739961e..51c9949633e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -97,6 +97,31 @@ EXPORT_SYMBOL(get_cmd_string); | |||
97 | 97 | ||
98 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) | 98 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) |
99 | 99 | ||
100 | static int iwl_generic_cmd_callback(struct iwl_priv *priv, | ||
101 | struct iwl_cmd *cmd, struct sk_buff *skb) | ||
102 | { | ||
103 | struct iwl4965_rx_packet *pkt = NULL; | ||
104 | |||
105 | if (!skb) { | ||
106 | IWL_ERROR("Error: Response NULL in %s.\n", | ||
107 | get_cmd_string(cmd->hdr.cmd)); | ||
108 | return 1; | ||
109 | } | ||
110 | |||
111 | pkt = (struct iwl4965_rx_packet *)skb->data; | ||
112 | if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { | ||
113 | IWL_ERROR("Bad return from %s (0x%08X)\n", | ||
114 | get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | ||
115 | return 1; | ||
116 | } | ||
117 | |||
118 | IWL_DEBUG_HC("back from %s (0x%08X)\n", | ||
119 | get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | ||
120 | |||
121 | /* Let iwl_tx_complete free the response skb */ | ||
122 | return 1; | ||
123 | } | ||
124 | |||
100 | static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | 125 | static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) |
101 | { | 126 | { |
102 | int ret; | 127 | int ret; |
@@ -106,8 +131,9 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
106 | /* An asynchronous command can not expect an SKB to be set. */ | 131 | /* An asynchronous command can not expect an SKB to be set. */ |
107 | BUG_ON(cmd->meta.flags & CMD_WANT_SKB); | 132 | BUG_ON(cmd->meta.flags & CMD_WANT_SKB); |
108 | 133 | ||
109 | /* An asynchronous command MUST have a callback. */ | 134 | /* Assign a generic callback if one is not provided */ |
110 | BUG_ON(!cmd->meta.u.callback); | 135 | if (!cmd->meta.u.callback) |
136 | cmd->meta.u.callback = iwl_generic_cmd_callback; | ||
111 | 137 | ||
112 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 138 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
113 | return -EBUSY; | 139 | return -EBUSY; |