summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
diff options
context:
space:
mode:
authorDon Fry <donald.h.fry@intel.com>2011-11-10 06:55:08 -0800
committerJohn W. Linville <linville@tuxdriver.com>2011-11-11 12:32:53 -0500
commit8929c24bf2ef4fb983ff86478116092080f8773f (patch)
tree0d6cbc896e9711d3fccee81dcc51ae1061c0ce4d /drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
parent5703ddb01328c8ee3fa315273ea3b29f6524fb38 (diff)
iwlagn: remove knowledge of ucode image location from upper layers
The upper layers of the driver do not need to know where the ucode is stored. It already passes in an enum of which ucode to load. Let the lower layer routines select the ucode to load. Signed-off-by: Don Fry <donald.h.fry@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-agn-ucode.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 502659afe1f..1ad4af42f37 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -125,6 +125,22 @@ static int iwlagn_load_section(struct iwl_trans *trans, const char *name,
return 0;
}
+static inline struct fw_img *iwl_get_ucode_image(struct iwl_priv *priv,
+ enum iwlagn_ucode_type ucode_type)
+{
+ switch (ucode_type) {
+ case IWL_UCODE_INIT:
+ return &priv->ucode_init;
+ case IWL_UCODE_WOWLAN:
+ return &priv->ucode_wowlan;
+ case IWL_UCODE_REGULAR:
+ return &priv->ucode_rt;
+ case IWL_UCODE_NONE:
+ break;
+ }
+ return NULL;
+}
+
static int iwlagn_load_given_ucode(struct iwl_priv *priv,
struct fw_img *image)
{
@@ -520,13 +536,18 @@ static void iwlagn_alive_fn(struct iwl_priv *priv,
#define UCODE_CALIB_TIMEOUT (2*HZ)
int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
- struct fw_img *image,
enum iwlagn_ucode_type ucode_type)
{
struct iwl_notification_wait alive_wait;
struct iwlagn_alive_data alive_data;
int ret;
enum iwlagn_ucode_type old_type;
+ struct fw_img *image = iwl_get_ucode_image(priv, ucode_type);
+
+ if (!image) {
+ IWL_ERR(priv, "Invalid ucode requested (%d)\n", ucode_type);
+ return -EINVAL;
+ }
ret = iwl_trans_start_device(trans(priv));
if (ret)
@@ -609,8 +630,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)
NULL, NULL);
/* Will also start the device */
- ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
- IWL_UCODE_INIT);
+ ret = iwlagn_load_ucode_wait_alive(priv, IWL_UCODE_INIT);
if (ret)
goto error;