aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorRon Rindjunsky <ron.rindjunsky@intel.com>2008-04-23 20:14:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:17 -0400
commit399f490067992715044cbf2be1923e2f613b2e18 (patch)
tree03db5be67dcde4fdb68cf15e6ccdb52b23efac55 /drivers/net/wireless/iwlwifi/iwl-4965.c
parent8614f360bdc7db8d35609a9c771601f1d45539e5 (diff)
iwlwifi: handle shared memory
This patch generalize the use of shared memory, as size of this memory is now allocated and freed by handlers, and also changes the location of those actions for better resource management Signed-off-by: Ron Rindjunsky <ron.rindjunsky@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/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a41a83a5f816..e80f6022cf43 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -276,18 +276,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
276 spin_lock_init(&priv->hcmd_lock); 276 spin_lock_init(&priv->hcmd_lock);
277 spin_lock_init(&priv->lq_mngr.lock); 277 spin_lock_init(&priv->lq_mngr.lock);
278 278
279 priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
280 sizeof(struct iwl4965_shared),
281 &priv->shared_phys);
282
283 if (!priv->shared_virt) {
284 ret = -ENOMEM;
285 goto err;
286 }
287
288 memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared));
289
290
291 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) 279 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++)
292 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); 280 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]);
293 281
@@ -2492,6 +2480,28 @@ static void iwl4965_hw_card_show_info(struct iwl_priv *priv)
2492 &priv->eeprom[EEPROM_4965_BOARD_PBA]); 2480 &priv->eeprom[EEPROM_4965_BOARD_PBA]);
2493} 2481}
2494 2482
2483static int iwl4965_alloc_shared_mem(struct iwl_priv *priv)
2484{
2485 priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
2486 sizeof(struct iwl4965_shared),
2487 &priv->shared_phys);
2488 if (!priv->shared_virt)
2489 return -ENOMEM;
2490
2491 memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared));
2492
2493 return 0;
2494}
2495
2496static void iwl4965_free_shared_mem(struct iwl_priv *priv)
2497{
2498 if (priv->shared_virt)
2499 pci_free_consistent(priv->pci_dev,
2500 sizeof(struct iwl4965_shared),
2501 priv->shared_virt,
2502 priv->shared_phys);
2503}
2504
2495#define IWL_TX_CRC_SIZE 4 2505#define IWL_TX_CRC_SIZE 4
2496#define IWL_TX_DELIMITER_SIZE 4 2506#define IWL_TX_DELIMITER_SIZE 4
2497 2507
@@ -4351,6 +4361,8 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
4351static struct iwl_lib_ops iwl4965_lib = { 4361static struct iwl_lib_ops iwl4965_lib = {
4352 .init_drv = iwl4965_init_drv, 4362 .init_drv = iwl4965_init_drv,
4353 .set_hw_params = iwl4965_hw_set_hw_params, 4363 .set_hw_params = iwl4965_hw_set_hw_params,
4364 .alloc_shared_mem = iwl4965_alloc_shared_mem,
4365 .free_shared_mem = iwl4965_free_shared_mem,
4354 .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, 4366 .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl,
4355 .hw_nic_init = iwl4965_hw_nic_init, 4367 .hw_nic_init = iwl4965_hw_nic_init,
4356 .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, 4368 .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr,