diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-01-14 20:46:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:58 -0500 |
commit | 98c92211462bb78fe0e869b43e1662e549e35fed (patch) | |
tree | 0cfed83c186d801cb06e9d3aac4c7a3014e302f8 /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | e655b9f03f41c7a84fb74d6619abf844d7f2ab65 (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/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 66 |
1 files changed, 12 insertions, 54 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b9a74f5eea51..d886962392ef 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -5479,48 +5479,12 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5479 | 5479 | ||
5480 | static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv) | 5480 | static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv) |
5481 | { | 5481 | { |
5482 | if (priv->ucode_code.v_addr != NULL) { | 5482 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); |
5483 | pci_free_consistent(priv->pci_dev, | 5483 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); |
5484 | priv->ucode_code.len, | 5484 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); |
5485 | priv->ucode_code.v_addr, | 5485 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init); |
5486 | priv->ucode_code.p_addr); | 5486 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); |
5487 | priv->ucode_code.v_addr = NULL; | 5487 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); |
5488 | } | ||
5489 | if (priv->ucode_data.v_addr != NULL) { | ||
5490 | pci_free_consistent(priv->pci_dev, | ||
5491 | priv->ucode_data.len, | ||
5492 | priv->ucode_data.v_addr, | ||
5493 | priv->ucode_data.p_addr); | ||
5494 | priv->ucode_data.v_addr = NULL; | ||
5495 | } | ||
5496 | if (priv->ucode_data_backup.v_addr != NULL) { | ||
5497 | pci_free_consistent(priv->pci_dev, | ||
5498 | priv->ucode_data_backup.len, | ||
5499 | priv->ucode_data_backup.v_addr, | ||
5500 | priv->ucode_data_backup.p_addr); | ||
5501 | priv->ucode_data_backup.v_addr = NULL; | ||
5502 | } | ||
5503 | if (priv->ucode_init.v_addr != NULL) { | ||
5504 | pci_free_consistent(priv->pci_dev, | ||
5505 | priv->ucode_init.len, | ||
5506 | priv->ucode_init.v_addr, | ||
5507 | priv->ucode_init.p_addr); | ||
5508 | priv->ucode_init.v_addr = NULL; | ||
5509 | } | ||
5510 | if (priv->ucode_init_data.v_addr != NULL) { | ||
5511 | pci_free_consistent(priv->pci_dev, | ||
5512 | priv->ucode_init_data.len, | ||
5513 | priv->ucode_init_data.v_addr, | ||
5514 | priv->ucode_init_data.p_addr); | ||
5515 | priv->ucode_init_data.v_addr = NULL; | ||
5516 | } | ||
5517 | if (priv->ucode_boot.v_addr != NULL) { | ||
5518 | pci_free_consistent(priv->pci_dev, | ||
5519 | priv->ucode_boot.len, | ||
5520 | priv->ucode_boot.v_addr, | ||
5521 | priv->ucode_boot.p_addr); | ||
5522 | priv->ucode_boot.v_addr = NULL; | ||
5523 | } | ||
5524 | } | 5488 | } |
5525 | 5489 | ||
5526 | /** | 5490 | /** |
@@ -5817,12 +5781,6 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv) | |||
5817 | iwl3945_write32(priv, CSR_RESET, 0); | 5781 | iwl3945_write32(priv, CSR_RESET, 0); |
5818 | } | 5782 | } |
5819 | 5783 | ||
5820 | static int iwl3945_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) | ||
5821 | { | ||
5822 | desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); | ||
5823 | return (desc->v_addr != NULL) ? 0 : -ENOMEM; | ||
5824 | } | ||
5825 | |||
5826 | /** | 5784 | /** |
5827 | * iwl3945_read_ucode - Read uCode images from disk file. | 5785 | * iwl3945_read_ucode - Read uCode images from disk file. |
5828 | * | 5786 | * |
@@ -5925,13 +5883,13 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) | |||
5925 | * 1) unmodified from disk | 5883 | * 1) unmodified from disk |
5926 | * 2) backup cache for save/restore during power-downs */ | 5884 | * 2) backup cache for save/restore during power-downs */ |
5927 | priv->ucode_code.len = inst_size; | 5885 | priv->ucode_code.len = inst_size; |
5928 | iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); | 5886 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); |
5929 | 5887 | ||
5930 | priv->ucode_data.len = data_size; | 5888 | priv->ucode_data.len = data_size; |
5931 | iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); | 5889 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); |
5932 | 5890 | ||
5933 | priv->ucode_data_backup.len = data_size; | 5891 | priv->ucode_data_backup.len = data_size; |
5934 | iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 5892 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); |
5935 | 5893 | ||
5936 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || | 5894 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || |
5937 | !priv->ucode_data_backup.v_addr) | 5895 | !priv->ucode_data_backup.v_addr) |
@@ -5940,10 +5898,10 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) | |||
5940 | /* Initialization instructions and data */ | 5898 | /* Initialization instructions and data */ |
5941 | if (init_size && init_data_size) { | 5899 | if (init_size && init_data_size) { |
5942 | priv->ucode_init.len = init_size; | 5900 | priv->ucode_init.len = init_size; |
5943 | iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); | 5901 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); |
5944 | 5902 | ||
5945 | priv->ucode_init_data.len = init_data_size; | 5903 | priv->ucode_init_data.len = init_data_size; |
5946 | iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 5904 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); |
5947 | 5905 | ||
5948 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) | 5906 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) |
5949 | goto err_pci_alloc; | 5907 | goto err_pci_alloc; |
@@ -5952,7 +5910,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) | |||
5952 | /* Bootstrap (instructions only, no data) */ | 5910 | /* Bootstrap (instructions only, no data) */ |
5953 | if (boot_size) { | 5911 | if (boot_size) { |
5954 | priv->ucode_boot.len = boot_size; | 5912 | priv->ucode_boot.len = boot_size; |
5955 | iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); | 5913 | iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); |
5956 | 5914 | ||
5957 | if (!priv->ucode_boot.v_addr) | 5915 | if (!priv->ucode_boot.v_addr) |
5958 | goto err_pci_alloc; | 5916 | goto err_pci_alloc; |