Linux wireless drivers development
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net,
	Johannes Berg <johannes.berg@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>
Subject: [PATCH 18/47] iwl3945: remove ucode access indirection
Date: Mon, 10 May 2010 15:27:49 -0700	[thread overview]
Message-ID: <1273530498-11876-19-git-send-email-reinette.chatre@intel.com> (raw)
In-Reply-To: <1273530498-11876-1-git-send-email-reinette.chatre@intel.com>

From: Johannes Berg <johannes.berg@intel.com>

As these function pointers will always point to
the 3945 functions, we can just call them directly
and avoid the indirection.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945.c     |   40 ---------------------------
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   39 ++++++++++++++++++++------
 2 files changed, 30 insertions(+), 49 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 1e95939..a4d842a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -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,
@@ -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,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 9486b32..e9de109 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -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.
  *
@@ -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;
@@ -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
@@ -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) {
 
-- 
1.6.3.3


  parent reply	other threads:[~2010-05-10 22:28 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10 22:27 [PATCH 00/47] iwlwifi updates for 2.6.35 Reinette Chatre
2010-05-10 22:27 ` [PATCH 01/47] iwlwifi: rename 6000 series Gen2 devices to Gen2a Reinette Chatre
2010-05-10 22:46   ` Gábor Stefanik
2010-05-10 22:52     ` Zhao, Shanyu
2010-05-10 22:27 ` [PATCH 02/47] iwl3945: fix scan races Reinette Chatre
2010-05-10 22:27 ` [PATCH 03/47] iwlwifi: remove powersave debugfs if it is not supported Reinette Chatre
2010-05-10 22:27 ` [PATCH 04/47] iwlwifi: rename "tx_power" to "chain_tx_power" Reinette Chatre
2010-05-10 22:27 ` [PATCH 05/47] iwlwifi: use vif iwl_bss_info_changed Reinette Chatre
2010-05-10 22:27 ` [PATCH 06/47] iwlwifi: remove device type checking for tx power in debugfs Reinette Chatre
2010-05-10 22:27 ` [PATCH 07/47] iwlwifi: use .cfg to enable/disable continuous ucode trace Reinette Chatre
2010-05-10 22:27 ` [PATCH 08/47] iwlwifi: use cfg to configure calibration operation Reinette Chatre
2010-05-10 22:27 ` [PATCH 09/47] iwlwifi: give correct return information for tx power debugfs Reinette Chatre
2010-05-10 22:27 ` [PATCH 10/47] iwlwifi: wimax co-exist code clean up Reinette Chatre
2010-05-10 22:27 ` [PATCH 11/47] iwlwifi: checking for all the possible failure cases Reinette Chatre
2010-05-10 22:27 ` [PATCH 12/47] iwlwifi: dump firmware build info in error case Reinette Chatre
2010-05-10 22:27 ` [PATCH 13/47] iwlwifi: make bcast LQ command available for later restore actions Reinette Chatre
2010-05-10 22:27 ` [PATCH 14/47] iwl3945: use iwl3945_add_bcast_station Reinette Chatre
2010-05-10 22:27 ` [PATCH 15/47] iwlwifi: pass address to iwl_remove_station Reinette Chatre
2010-05-10 22:27 ` [PATCH 16/47] iwlwifi: manage IBSS station properly Reinette Chatre
2010-05-10 22:27 ` [PATCH 17/47] iwlagn: show and store firmware build number Reinette Chatre
2010-05-10 22:27 ` Reinette Chatre [this message]
2010-05-10 22:27 ` [PATCH 19/47] iwlwifi: remove ucode virtual functions Reinette Chatre
2010-05-10 22:27 ` [PATCH 20/47] iwlwifi: move eeprom version printout to eeprom init Reinette Chatre
2010-05-10 22:27 ` [PATCH 21/47] iwlagn: prepare for new firmware file format Reinette Chatre
2010-05-10 22:27 ` [PATCH 22/47] iwlagn: implement loading a new firmware file type Reinette Chatre
2010-05-10 22:27 ` [PATCH 23/47] iwl3945: add plcp error checking Reinette Chatre
2010-05-10 22:27 ` [PATCH 24/47] iwlwifi: remove rts_threshold Reinette Chatre
2010-05-10 22:27 ` [PATCH 25/47] iwlagn: move iwl_get_ra_sta_id to 4965 Reinette Chatre
2010-05-10 22:27 ` [PATCH 26/47] iwlagn: use vif->type to check station Reinette Chatre
2010-05-10 22:27 ` [PATCH 27/47] iwlwifi: apply filter flags directly Reinette Chatre
2010-05-10 22:27 ` [PATCH 28/47] iwlwifi: push virtual interface through Reinette Chatre
2010-05-10 22:28 ` [PATCH 29/47] iwlagn: use virtual interface in TX aggregation handling Reinette Chatre
2010-05-10 22:28 ` [PATCH 30/47] iwlwifi: remove useless priv->vif check Reinette Chatre
2010-05-10 22:28 ` [PATCH 31/47] iwlwifi: use vif in iwl_ht_conf Reinette Chatre
2010-05-10 22:28 ` [PATCH 32/47] iwlwifi: note that priv->bssid is used only by 3945 Reinette Chatre
2010-05-10 22:28 ` [PATCH 33/47] iwlwifi: fix iwl_sta_init_lq station ID Reinette Chatre
2010-05-10 22:28 ` [PATCH 34/47] iwlwifi: split allocation/sending local station LQ Reinette Chatre
2010-05-10 22:28 ` [PATCH 35/47] iwlwifi: rework broadcast station management Reinette Chatre
2010-05-10 22:28 ` [PATCH 36/47] iwlagn: work around rate scaling reset delay Reinette Chatre
2010-05-10 22:28 ` [PATCH 37/47] iwlwifi: "tx power per chain" are part of ucode_tx_stats Reinette Chatre
2010-05-10 22:28 ` [PATCH 38/47] iwlwifi: provide more comments for cfg structure Reinette Chatre
2010-05-10 22:28 ` [PATCH 39/47] iwlwifi: track station IDs Reinette Chatre
2010-05-10 22:28 ` [PATCH 40/47] iwlwifi: add iwl_sta_id() Reinette Chatre
2010-05-10 22:28 ` [PATCH 41/47] iwlwifi: use iwl_find_station less Reinette Chatre
2010-05-10 22:28 ` [PATCH 42/47] iwlagn: use iwl_sta_id() for aggregation Reinette Chatre
2010-05-10 22:28 ` [PATCH 43/47] iwlwifi: use iwl_sta_id() for TKIP key update Reinette Chatre
2010-05-10 22:28 ` [PATCH 44/47] iwlwifi: move iwl_find_station() to 4965 Reinette Chatre
2010-05-10 22:28 ` [PATCH 45/47] iwlwifi: rename iwl_add_local_station Reinette Chatre
2010-05-10 22:28 ` [PATCH 46/47] iwlwifi: remove pointless HT check Reinette Chatre
2010-05-10 22:28 ` [PATCH 47/47] iwlwifi: clear driver stations when going down Reinette Chatre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273530498-11876-19-git-send-email-reinette.chatre@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox