Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102465
b: refs/heads/master
c: 399f490
h: refs/heads/master
i:
  102463: 12abf70
v: v3
  • Loading branch information
Ron Rindjunsky authored and John W. Linville committed May 7, 2008
1 parent ae74edc commit 14ddd74
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8614f360bdc7db8d35609a9c771601f1d45539e5
refs/heads/master: 399f490067992715044cbf2be1923e2f613b2e18
36 changes: 24 additions & 12 deletions trunk/drivers/net/wireless/iwlwifi/iwl-4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
spin_lock_init(&priv->hcmd_lock);
spin_lock_init(&priv->lq_mngr.lock);

priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
sizeof(struct iwl4965_shared),
&priv->shared_phys);

if (!priv->shared_virt) {
ret = -ENOMEM;
goto err;
}

memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared));


for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&priv->ibss_mac_hash[i]);

Expand Down Expand Up @@ -2492,6 +2480,28 @@ static void iwl4965_hw_card_show_info(struct iwl_priv *priv)
&priv->eeprom[EEPROM_4965_BOARD_PBA]);
}

static int iwl4965_alloc_shared_mem(struct iwl_priv *priv)
{
priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
sizeof(struct iwl4965_shared),
&priv->shared_phys);
if (!priv->shared_virt)
return -ENOMEM;

memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared));

return 0;
}

static void iwl4965_free_shared_mem(struct iwl_priv *priv)
{
if (priv->shared_virt)
pci_free_consistent(priv->pci_dev,
sizeof(struct iwl4965_shared),
priv->shared_virt,
priv->shared_phys);
}

#define IWL_TX_CRC_SIZE 4
#define IWL_TX_DELIMITER_SIZE 4

Expand Down Expand Up @@ -4351,6 +4361,8 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
static struct iwl_lib_ops iwl4965_lib = {
.init_drv = iwl4965_init_drv,
.set_hw_params = iwl4965_hw_set_hw_params,
.alloc_shared_mem = iwl4965_alloc_shared_mem,
.free_shared_mem = iwl4965_free_shared_mem,
.txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl,
.hw_nic_init = iwl4965_hw_nic_init,
.is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr,
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ struct iwl_lib_ops {
int (*init_drv)(struct iwl_priv *priv);
/* set hw dependant perameters */
int (*set_hw_params)(struct iwl_priv *priv);

/* ucode shared memory */
int (*alloc_shared_mem)(struct iwl_priv *priv);
void (*free_shared_mem)(struct iwl_priv *priv);
void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv,
struct iwl4965_tx_queue *txq,
u16 byte_cnt);
Expand Down
23 changes: 9 additions & 14 deletions trunk/drivers/net/wireless/iwlwifi/iwl4965-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,15 +1128,6 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
*
******************************************************************************/

static void iwl4965_unset_hw_params(struct iwl_priv *priv)
{
if (priv->shared_virt)
pci_free_consistent(priv->pci_dev,
sizeof(struct iwl4965_shared),
priv->shared_virt,
priv->shared_phys);
}

/**
* iwl4965_supported_rate_to_ie - fill in the supported rate in IE field
*
Expand Down Expand Up @@ -5298,6 +5289,7 @@ static void __iwl4965_down(struct iwl_priv *priv)
iwl4965_hw_nic_stop_master(priv);
iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
iwl4965_hw_nic_reset(priv);
priv->cfg->ops->lib->free_shared_mem(priv);

exit:
memset(&priv->card_alive, 0, sizeof(struct iwl4965_alive_resp));
Expand Down Expand Up @@ -5359,6 +5351,12 @@ static int __iwl4965_up(struct iwl_priv *priv)
iwl_rfkill_set_hw_state(priv);
iwl_write32(priv, CSR_INT, 0xFFFFFFFF);

ret = priv->cfg->ops->lib->alloc_shared_mem(priv);
if (ret) {
IWL_ERROR("Unable to allocate shared memory\n");
return ret;
}

ret = priv->cfg->ops->lib->hw_nic_init(priv);
if (ret) {
IWL_ERROR("Unable to init nic\n");
Expand Down Expand Up @@ -7503,7 +7501,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e

err = iwl_setup(priv);
if (err)
goto out_unset_hw_params;
goto out_free_eeprom;
/* At this point both hw and priv are initialized. */

/**********************************
Expand All @@ -7529,7 +7527,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group);
if (err) {
IWL_ERROR("failed to create sysfs device attributes\n");
goto out_unset_hw_params;
goto out_free_eeprom;
}

err = iwl_dbgfs_register(priv, DRV_NAME);
Expand All @@ -7553,8 +7551,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e

out_remove_sysfs:
sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
out_unset_hw_params:
iwl4965_unset_hw_params(priv);
out_free_eeprom:
iwl_eeprom_free(priv);
out_iounmap:
Expand Down Expand Up @@ -7618,7 +7614,6 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
iwl4965_rx_queue_free(priv, &priv->rxq);
iwl4965_hw_txq_ctx_free(priv);

iwl4965_unset_hw_params(priv);
iwlcore_clear_stations_table(priv);
iwl_eeprom_free(priv);

Expand Down

0 comments on commit 14ddd74

Please sign in to comment.