Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195203
b: refs/heads/master
c: 93b1a2f
h: refs/heads/master
i:
  195201: 790ef5a
  195199: bf46c74
v: v3
  • Loading branch information
Johannes Berg authored and Reinette Chatre committed May 10, 2010
1 parent 9185879 commit b245ee6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 50 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: 3e4de7616fea5c68a9300af0e347a7f014ddcc63
refs/heads/master: 93b1a2f919a752bb689fdb0c5817c643c2f74435
40 changes: 0 additions & 40 deletions trunk/drivers/net/wireless/iwlwifi/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -2751,51 +2751,12 @@ static int iwl3945_load_bsm(struct iwl_priv *priv)
return 0;
}

#define IWL3945_UCODE_GET(item) \
static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode,\
u32 api_ver) \
{ \
return le32_to_cpu(ucode->u.v1.item); \
}

static u32 iwl3945_ucode_get_header_size(u32 api_ver)
{
return UCODE_HEADER_SIZE(1);
}
static u32 iwl3945_ucode_get_build(const struct iwl_ucode_header *ucode,
u32 api_ver)
{
return 0;
}
static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode,
u32 api_ver)
{
return (u8 *) ucode->u.v1.data;
}

IWL3945_UCODE_GET(inst_size);
IWL3945_UCODE_GET(data_size);
IWL3945_UCODE_GET(init_size);
IWL3945_UCODE_GET(init_data_size);
IWL3945_UCODE_GET(boot_size);

static struct iwl_hcmd_ops iwl3945_hcmd = {
.rxon_assoc = iwl3945_send_rxon_assoc,
.commit_rxon = iwl3945_commit_rxon,
.send_bt_config = iwl_send_bt_config,
};

static struct iwl_ucode_ops iwl3945_ucode = {
.get_header_size = iwl3945_ucode_get_header_size,
.get_build = iwl3945_ucode_get_build,
.get_inst_size = iwl3945_ucode_get_inst_size,
.get_data_size = iwl3945_ucode_get_data_size,
.get_init_size = iwl3945_ucode_get_init_size,
.get_init_data_size = iwl3945_ucode_get_init_data_size,
.get_boot_size = iwl3945_ucode_get_boot_size,
.get_data = iwl3945_ucode_get_data,
};

static struct iwl_lib_ops iwl3945_lib = {
.txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd,
.txq_free_tfd = iwl3945_hw_txq_free_tfd,
Expand Down Expand Up @@ -2847,7 +2808,6 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
};

static const struct iwl_ops iwl3945_ops = {
.ucode = &iwl3945_ucode,
.lib = &iwl3945_lib,
.hcmd = &iwl3945_hcmd,
.utils = &iwl3945_hcmd_utils,
Expand Down
39 changes: 30 additions & 9 deletions trunk/drivers/net/wireless/iwlwifi/iwl3945-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,28 @@ static void iwl3945_nic_start(struct iwl_priv *priv)
iwl_write32(priv, CSR_RESET, 0);
}

#define IWL3945_UCODE_GET(item) \
static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode)\
{ \
return le32_to_cpu(ucode->u.v1.item); \
}

static u32 iwl3945_ucode_get_header_size(u32 api_ver)
{
return UCODE_HEADER_SIZE(1);
}

static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode)
{
return (u8 *) ucode->u.v1.data;
}

IWL3945_UCODE_GET(inst_size);
IWL3945_UCODE_GET(data_size);
IWL3945_UCODE_GET(init_size);
IWL3945_UCODE_GET(init_data_size);
IWL3945_UCODE_GET(boot_size);

/**
* iwl3945_read_ucode - Read uCode images from disk file.
*
Expand Down Expand Up @@ -2157,7 +2179,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
goto error;

/* Make sure that we got at least our header! */
if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) {
if (ucode_raw->size < iwl3945_ucode_get_header_size(1)) {
IWL_ERR(priv, "File size way too small!\n");
ret = -EINVAL;
goto err_release;
Expand All @@ -2168,13 +2190,12 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)

priv->ucode_ver = le32_to_cpu(ucode->ver);
api_ver = IWL_UCODE_API(priv->ucode_ver);
inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver);
data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver);
init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver);
init_data_size =
priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver);
boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver);
src = priv->cfg->ops->ucode->get_data(ucode, api_ver);
inst_size = iwl3945_ucode_get_inst_size(ucode);
data_size = iwl3945_ucode_get_data_size(ucode);
init_size = iwl3945_ucode_get_init_size(ucode);
init_data_size = iwl3945_ucode_get_init_data_size(ucode);
boot_size = iwl3945_ucode_get_boot_size(ucode);
src = iwl3945_ucode_get_data(ucode);

/* api_ver should match the api version forming part of the
* firmware filename ... but we don't check for that and only rely
Expand Down Expand Up @@ -2223,7 +2244,7 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)


/* Verify size of file vs. image size info in file's header */
if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) +
if (ucode_raw->size != iwl3945_ucode_get_header_size(api_ver) +
inst_size + data_size + init_size +
init_data_size + boot_size) {

Expand Down

0 comments on commit b245ee6

Please sign in to comment.