Commit 22adba2a authored by Johannes Berg's avatar Johannes Berg Committed by Reinette Chatre
Browse files

iwlwifi: remove ucode virtual functions



AGN devices all use the same ucode operations,
except for 4965, because 4965 uses only v1 file
headers.

Therefore, we can remove all the indirection
we have here and just code the API distinction
in place, with a small special case for 4965.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
parent 93b1a2f9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -225,7 +225,6 @@ static struct iwl_lib_ops iwl1000_lib = {
};

static const struct iwl_ops iwl1000_ops = {
	.ucode = &iwlagn_ucode,
	.lib = &iwl1000_lib,
	.hcmd = &iwlagn_hcmd,
	.utils = &iwlagn_hcmd_utils,
+0 −39
Original line number Diff line number Diff line
@@ -2112,34 +2112,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
	cancel_work_sync(&priv->txpower_work);
}

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

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

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

static struct iwl_hcmd_ops iwl4965_hcmd = {
	.rxon_assoc = iwl4965_send_rxon_assoc,
	.commit_rxon = iwl_commit_rxon,
@@ -2147,16 +2119,6 @@ static struct iwl_hcmd_ops iwl4965_hcmd = {
	.send_bt_config = iwl_send_bt_config,
};

static struct iwl_ucode_ops iwl4965_ucode = {
	.get_header_size = iwl4965_ucode_get_header_size,
	.get_build = iwl4965_ucode_get_build,
	.get_inst_size = iwl4965_ucode_get_inst_size,
	.get_data_size = iwl4965_ucode_get_data_size,
	.get_init_size = iwl4965_ucode_get_init_size,
	.get_init_data_size = iwl4965_ucode_get_init_data_size,
	.get_boot_size = iwl4965_ucode_get_boot_size,
	.get_data = iwl4965_ucode_get_data,
};
static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
	.get_hcmd_size = iwl4965_get_hcmd_size,
	.build_addsta_hcmd = iwl4965_build_addsta_hcmd,
@@ -2229,7 +2191,6 @@ static struct iwl_lib_ops iwl4965_lib = {
};

static const struct iwl_ops iwl4965_ops = {
	.ucode = &iwl4965_ucode,
	.lib = &iwl4965_lib,
	.hcmd = &iwl4965_hcmd,
	.utils = &iwl4965_hcmd_utils,
+0 −2
Original line number Diff line number Diff line
@@ -427,7 +427,6 @@ static struct iwl_lib_ops iwl5150_lib = {
};

static const struct iwl_ops iwl5000_ops = {
	.ucode = &iwlagn_ucode,
	.lib = &iwl5000_lib,
	.hcmd = &iwlagn_hcmd,
	.utils = &iwlagn_hcmd_utils,
@@ -435,7 +434,6 @@ static const struct iwl_ops iwl5000_ops = {
};

static const struct iwl_ops iwl5150_ops = {
	.ucode = &iwlagn_ucode,
	.lib = &iwl5150_lib,
	.hcmd = &iwlagn_hcmd,
	.utils = &iwlagn_hcmd_utils,
+0 −2
Original line number Diff line number Diff line
@@ -330,7 +330,6 @@ static struct iwl_lib_ops iwl6000_lib = {
};

static const struct iwl_ops iwl6000_ops = {
	.ucode = &iwlagn_ucode,
	.lib = &iwl6000_lib,
	.hcmd = &iwlagn_hcmd,
	.utils = &iwlagn_hcmd_utils,
@@ -404,7 +403,6 @@ static struct iwl_lib_ops iwl6050_lib = {
};

static const struct iwl_ops iwl6050_ops = {
	.ucode = &iwlagn_ucode,
	.lib = &iwl6050_lib,
	.hcmd = &iwlagn_hcmd,
	.utils = &iwlagn_hcmd_utils,
+0 −49
Original line number Diff line number Diff line
@@ -182,55 +182,6 @@ int iwlagn_load_ucode(struct iwl_priv *priv)
	return ret;
}

#define IWL_UCODE_GET(item)						\
static u32 iwlagn_ucode_get_##item(const struct iwl_ucode_header *ucode,\
				    u32 api_ver)			\
{									\
	if (api_ver <= 2)						\
		return le32_to_cpu(ucode->u.v1.item);			\
	return le32_to_cpu(ucode->u.v2.item);				\
}

static u32 iwlagn_ucode_get_header_size(u32 api_ver)
{
	if (api_ver <= 2)
		return UCODE_HEADER_SIZE(1);
	return UCODE_HEADER_SIZE(2);
}

static u32 iwlagn_ucode_get_build(const struct iwl_ucode_header *ucode,
				   u32 api_ver)
{
	if (api_ver <= 2)
		return 0;
	return le32_to_cpu(ucode->u.v2.build);
}

static u8 *iwlagn_ucode_get_data(const struct iwl_ucode_header *ucode,
				  u32 api_ver)
{
	if (api_ver <= 2)
		return (u8 *) ucode->u.v1.data;
	return (u8 *) ucode->u.v2.data;
}

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

struct iwl_ucode_ops iwlagn_ucode = {
	.get_header_size = iwlagn_ucode_get_header_size,
	.get_build = iwlagn_ucode_get_build,
	.get_inst_size = iwlagn_ucode_get_inst_size,
	.get_data_size = iwlagn_ucode_get_data_size,
	.get_init_size = iwlagn_ucode_get_init_size,
	.get_init_data_size = iwlagn_ucode_get_init_data_size,
	.get_boot_size = iwlagn_ucode_get_boot_size,
	.get_data = iwlagn_ucode_get_data,
};

/*
 *  Calibration
 */
Loading