diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 9486b3248245..e9de10964c51 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2109,6 +2109,28 @@ static void iwl3945_nic_start(struct iwl_priv *priv) | |||
2109 | iwl_write32(priv, CSR_RESET, 0); | 2109 | iwl_write32(priv, CSR_RESET, 0); |
2110 | } | 2110 | } |
2111 | 2111 | ||
2112 | #define IWL3945_UCODE_GET(item) \ | ||
2113 | static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\ | ||
2114 | { \ | ||
2115 | return le32_to_cpu(ucode->u.v1.item); \ | ||
2116 | } | ||
2117 | |||
2118 | static u32 iwl3945_ucode_get_header_size(u32 api_ver) | ||
2119 | { | ||
2120 | return UCODE_HEADER_SIZE(1); | ||
2121 | } | ||
2122 | |||
2123 | static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode) | ||
2124 | { | ||
2125 | return (u8 *) ucode->u.v1.data; | ||
2126 | } | ||
2127 | |||
2128 | IWL3945_UCODE_GET(inst_size); | ||
2129 | IWL3945_UCODE_GET(data_size); | ||
2130 | IWL3945_UCODE_GET(init_size); | ||
2131 | IWL3945_UCODE_GET(init_data_size); | ||
2132 | IWL3945_UCODE_GET(boot_size); | ||
2133 | |||
2112 | /** | 2134 | /** |
2113 | * iwl3945_read_ucode - Read uCode images from disk file. | 2135 | * iwl3945_read_ucode - Read uCode images from disk file. |
2114 | * | 2136 | * |
@@ -2157,7 +2179,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2157 | goto error; | 2179 | goto error; |
2158 | 2180 | ||
2159 | /* Make sure that we got at least our header! */ | 2181 | /* Make sure that we got at least our header! */ |
2160 | if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { | 2182 | if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) { |
2161 | IWL_ERR(priv, "File size way too small!\n"); | 2183 | IWL_ERR(priv, "File size way too small!\n"); |
2162 | ret = -EINVAL; | 2184 | ret = -EINVAL; |
2163 | goto err_release; | 2185 | goto err_release; |
@@ -2168,13 +2190,12 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2168 | 2190 | ||
2169 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 2191 | priv->ucode_ver = le32_to_cpu(ucode->ver); |
2170 | api_ver = IWL_UCODE_API(priv->ucode_ver); | 2192 | api_ver = IWL_UCODE_API(priv->ucode_ver); |
2171 | inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver); | 2193 | inst_size = iwl3945_ucode_get_inst_size(ucode); |
2172 | data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver); | 2194 | data_size = iwl3945_ucode_get_data_size(ucode); |
2173 | init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver); | 2195 | init_size = iwl3945_ucode_get_init_size(ucode); |
2174 | init_data_size = | 2196 | init_data_size = iwl3945_ucode_get_init_data_size(ucode); |
2175 | priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver); | 2197 | boot_size = iwl3945_ucode_get_boot_size(ucode); |
2176 | boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver); | 2198 | src = iwl3945_ucode_get_data(ucode); |
2177 | src = priv->cfg->ops->ucode->get_data(ucode, api_ver); | ||
2178 | 2199 | ||
2179 | /* api_ver should match the api version forming part of the | 2200 | /* api_ver should match the api version forming part of the |
2180 | * firmware filename ... but we don't check for that and only rely | 2201 | * firmware filename ... but we don't check for that and only rely |
@@ -2223,7 +2244,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv) | |||
2223 | 2244 | ||
2224 | 2245 | ||
2225 | /* Verify size of file vs. image size info in file's header */ | 2246 | /* Verify size of file vs. image size info in file's header */ |
2226 | if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) + | 2247 | if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) + |
2227 | inst_size + data_size + init_size + | 2248 | inst_size + data_size + init_size + |
2228 | init_data_size + boot_size) { | 2249 | init_data_size + boot_size) { |
2229 | 2250 | ||