aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-01-14 20:46:20 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:58 -0500
commit98c92211462bb78fe0e869b43e1662e549e35fed (patch)
tree0cfed83c186d801cb06e9d3aac4c7a3014e302f8 /drivers/net/wireless/iwlwifi/iwl4965-base.c
parente655b9f03f41c7a84fb74d6619abf844d7f2ab65 (diff)
iwlwifi: move uCode helper functions to iwl-helpers.h
This patch adds iwl_free_fw_desc ucode helper function. It also moves ucode helper functions to iwl-helpers.h. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 811e41b7f664..6361fe8478aa 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -5917,48 +5917,12 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv)
5917 5917
5918static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) 5918static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv)
5919{ 5919{
5920 if (priv->ucode_code.v_addr != NULL) { 5920 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code);
5921 pci_free_consistent(priv->pci_dev, 5921 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data);
5922 priv->ucode_code.len, 5922 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
5923 priv->ucode_code.v_addr, 5923 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init);
5924 priv->ucode_code.p_addr); 5924 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
5925 priv->ucode_code.v_addr = NULL; 5925 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
5926 }
5927 if (priv->ucode_data.v_addr != NULL) {
5928 pci_free_consistent(priv->pci_dev,
5929 priv->ucode_data.len,
5930 priv->ucode_data.v_addr,
5931 priv->ucode_data.p_addr);
5932 priv->ucode_data.v_addr = NULL;
5933 }
5934 if (priv->ucode_data_backup.v_addr != NULL) {
5935 pci_free_consistent(priv->pci_dev,
5936 priv->ucode_data_backup.len,
5937 priv->ucode_data_backup.v_addr,
5938 priv->ucode_data_backup.p_addr);
5939 priv->ucode_data_backup.v_addr = NULL;
5940 }
5941 if (priv->ucode_init.v_addr != NULL) {
5942 pci_free_consistent(priv->pci_dev,
5943 priv->ucode_init.len,
5944 priv->ucode_init.v_addr,
5945 priv->ucode_init.p_addr);
5946 priv->ucode_init.v_addr = NULL;
5947 }
5948 if (priv->ucode_init_data.v_addr != NULL) {
5949 pci_free_consistent(priv->pci_dev,
5950 priv->ucode_init_data.len,
5951 priv->ucode_init_data.v_addr,
5952 priv->ucode_init_data.p_addr);
5953 priv->ucode_init_data.v_addr = NULL;
5954 }
5955 if (priv->ucode_boot.v_addr != NULL) {
5956 pci_free_consistent(priv->pci_dev,
5957 priv->ucode_boot.len,
5958 priv->ucode_boot.v_addr,
5959 priv->ucode_boot.p_addr);
5960 priv->ucode_boot.v_addr = NULL;
5961 }
5962} 5926}
5963 5927
5964/** 5928/**
@@ -6257,11 +6221,6 @@ static void iwl4965_nic_start(struct iwl4965_priv *priv)
6257 iwl4965_write32(priv, CSR_RESET, 0); 6221 iwl4965_write32(priv, CSR_RESET, 0);
6258} 6222}
6259 6223
6260static int iwl4965_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc)
6261{
6262 desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr);
6263 return (desc->v_addr != NULL) ? 0 : -ENOMEM;
6264}
6265 6224
6266/** 6225/**
6267 * iwl4965_read_ucode - Read uCode images from disk file. 6226 * iwl4965_read_ucode - Read uCode images from disk file.
@@ -6372,21 +6331,21 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv)
6372 * 1) unmodified from disk 6331 * 1) unmodified from disk
6373 * 2) backup cache for save/restore during power-downs */ 6332 * 2) backup cache for save/restore during power-downs */
6374 priv->ucode_code.len = inst_size; 6333 priv->ucode_code.len = inst_size;
6375 iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); 6334 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
6376 6335
6377 priv->ucode_data.len = data_size; 6336 priv->ucode_data.len = data_size;
6378 iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); 6337 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
6379 6338
6380 priv->ucode_data_backup.len = data_size; 6339 priv->ucode_data_backup.len = data_size;
6381 iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); 6340 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
6382 6341
6383 /* Initialization instructions and data */ 6342 /* Initialization instructions and data */
6384 if (init_size && init_data_size) { 6343 if (init_size && init_data_size) {
6385 priv->ucode_init.len = init_size; 6344 priv->ucode_init.len = init_size;
6386 iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); 6345 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
6387 6346
6388 priv->ucode_init_data.len = init_data_size; 6347 priv->ucode_init_data.len = init_data_size;
6389 iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); 6348 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
6390 6349
6391 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) 6350 if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
6392 goto err_pci_alloc; 6351 goto err_pci_alloc;
@@ -6395,7 +6354,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv)
6395 /* Bootstrap (instructions only, no data) */ 6354 /* Bootstrap (instructions only, no data) */
6396 if (boot_size) { 6355 if (boot_size) {
6397 priv->ucode_boot.len = boot_size; 6356 priv->ucode_boot.len = boot_size;
6398 iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); 6357 iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
6399 6358
6400 if (!priv->ucode_boot.v_addr) 6359 if (!priv->ucode_boot.v_addr)
6401 goto err_pci_alloc; 6360 goto err_pci_alloc;